Submission #3415112
Source Code Expand
using System; using System.Linq;//リストの使用 using System.Collections.Generic; class Program { static void Main() { string s = Console.ReadLine(); string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。 long x = long.Parse(input[0]); long y = long.Parse(input[1]); long[] dpx = new long[s.Length+1][16001];//i回後に可能な到達地点+8000 long[] dpy = new long[s.Length+1][16001]; bool answer = false; long memoForward = 0; long turnCount = 0; for(long i = 0; i < s.Length; i++) { if(s[(int)i] == 'F') memoForward++; if(s[(int)i] == 'T' || i == s.Length-1) { if(turnCount == 0) { dpx[0][memoForward+8000] = 1; }else if(turnCount == 1) { dpy[1][memoForward+8000] = 1; dpy[1][-memoForward+8000] = 1; }else if(turnCount % 2 == 0) { for(long i = 0; i < 16001; i++) { if(dpx[turnCount-2][i] == 1) { dpx[turnCount][i-memoForward] = 1; dpx[turnCount][i+memoForward] = 1; } } }else if(turnCount % 2 == 1) { for(long i = 0; i < 16001; i++) { if(dpy[turnCount-2][i] == 1) { dpy[turnCount][i-memoForward] = 1; dpy[turnCount][i+memoForward] = 1; } } } turnCount++; memoForward = 0; } } if(turnCount % 2 == 0) { Console.WriteLine((dpx[turnCount-2][x] == 1 && (dpy[turnCount-1][y] == 1) ? "Yes" : "No"); }else if(turnCount % 2 == 1) { Console.WriteLine((dpx[turnCount-1][x] == 1 && (dpy[turnCount-2][y] == 1) ? "Yes" : "No"); } } }
Submission Info
Submission Time | |
---|---|
Task | D - FT Robot |
User | suikameron |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1861 Byte |
Status | CE |
Compile Error
./Main.cs(32,20): error CS0136: A local variable named `i' cannot be declared in this scope because it would give a different meaning to `i', which is already used in a `parent or current' scope to denote something else ./Main.cs(42,20): error CS0136: A local variable named `i' cannot be declared in this scope because it would give a different meaning to `i', which is already used in a `parent or current' scope to denote something else ./Main.cs(58,93): error CS1525: Unexpected symbol `;', expecting `)' or `,' ./Main.cs(61,93): error CS1525: Unexpected symbol `;', expecting `)' or `,'