Submission #3415191
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 j = 0; j < 16001; j++) { if(dpx[turnCount-2,j] == 1) { dpx[turnCount,j-memoForward] = 1; dpx[turnCount,j+memoForward] = 1; } } }else if(turnCount % 2 == 1) { for(long j = 0; j < 16001; j++) { if(dpy[turnCount-2,j] == 1) { dpy[turnCount,j-memoForward] = 1; dpy[turnCount,j+memoForward] = 1; } } } turnCount++; memoForward = 0; } } if(turnCount % 2 == 0 && turnCount >= 2) { Console.WriteLine((dpx[turnCount-2,x+8000] == 1 && dpy[turnCount-1,y+8000] == 1) ? "Yes" : "No"); }else if(turnCount % 2 == 1 && turnCount >= 2) { Console.WriteLine((dpx[turnCount-1,x+8000] == 1 && dpy[turnCount-2,y+8000] == 1) ? "Yes" : "No"); }else if (turnCount == 1) { Console.WriteLine((s.Length == x && y == 0) ? "Yes" : "No"); } } }
Submission Info
Submission Time | |
---|---|
Task | D - FT Robot |
User | suikameron |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 2008 Byte |
Status | MLE |
Exec Time | 825 ms |
Memory | 1989336 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 0_05.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 0_05.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt, 1_41.txt, 1_42.txt, 1_43.txt, 1_44.txt, 1_45.txt, 1_46.txt, 1_47.txt, 1_48.txt, 1_49.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 20 ms | 9144 KB |
0_01.txt | AC | 20 ms | 9016 KB |
0_02.txt | AC | 20 ms | 11616 KB |
0_03.txt | AC | 21 ms | 11616 KB |
0_04.txt | AC | 21 ms | 13164 KB |
0_05.txt | AC | 20 ms | 10080 KB |
1_00.txt | AC | 20 ms | 10968 KB |
1_01.txt | AC | 21 ms | 11168 KB |
1_02.txt | AC | 20 ms | 10972 KB |
1_03.txt | AC | 21 ms | 13016 KB |
1_04.txt | AC | 20 ms | 10972 KB |
1_05.txt | AC | 22 ms | 13016 KB |
1_06.txt | MLE | 436 ms | 1012440 KB |
1_07.txt | MLE | 438 ms | 1010392 KB |
1_08.txt | MLE | 574 ms | 1344216 KB |
1_09.txt | MLE | 575 ms | 1346264 KB |
1_10.txt | MLE | 572 ms | 1344216 KB |
1_11.txt | MLE | 572 ms | 1344216 KB |
1_12.txt | MLE | 289 ms | 676568 KB |
1_13.txt | MLE | 289 ms | 678616 KB |
1_14.txt | MLE | 430 ms | 1012440 KB |
1_15.txt | MLE | 430 ms | 1010392 KB |
1_16.txt | MLE | 428 ms | 1012440 KB |
1_17.txt | MLE | 428 ms | 1010392 KB |
1_18.txt | MLE | 428 ms | 991960 KB |
1_19.txt | MLE | 428 ms | 989912 KB |
1_20.txt | MLE | 428 ms | 991960 KB |
1_21.txt | MLE | 434 ms | 1008344 KB |
1_22.txt | MLE | 435 ms | 1004248 KB |
1_23.txt | MLE | 431 ms | 994008 KB |
1_24.txt | MLE | 438 ms | 1014488 KB |
1_25.txt | MLE | 428 ms | 989912 KB |
1_26.txt | MLE | 808 ms | 1948376 KB |
1_27.txt | MLE | 825 ms | 1989336 KB |
1_28.txt | MLE | 427 ms | 989912 KB |
1_29.txt | MLE | 432 ms | 1006296 KB |
1_30.txt | MLE | 229 ms | 516824 KB |
1_31.txt | AC | 216 ms | 488152 KB |
1_32.txt | AC | 126 ms | 269016 KB |
1_33.txt | AC | 122 ms | 256728 KB |
1_34.txt | AC | 70 ms | 131800 KB |
1_35.txt | AC | 67 ms | 127704 KB |
1_36.txt | AC | 46 ms | 72408 KB |
1_37.txt | AC | 52 ms | 88792 KB |
1_38.txt | AC | 35 ms | 43736 KB |
1_39.txt | AC | 36 ms | 43736 KB |
1_40.txt | AC | 27 ms | 27352 KB |
1_41.txt | AC | 30 ms | 33496 KB |
1_42.txt | MLE | 293 ms | 682712 KB |
1_43.txt | MLE | 292 ms | 680664 KB |
1_44.txt | MLE | 310 ms | 682712 KB |
1_45.txt | MLE | 299 ms | 680664 KB |
1_46.txt | MLE | 287 ms | 678744 KB |
1_47.txt | MLE | 295 ms | 680792 KB |
1_48.txt | MLE | 293 ms | 678744 KB |
1_49.txt | MLE | 303 ms | 682712 KB |