Submission #3415143


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] == 1 && dpy[turnCount-1,y] == 1) ? "Yes" : "No");
    }else if(turnCount % 2 == 1 && turnCount >= 2)
    {
		  Console.WriteLine((dpx[turnCount-1,x] == 1 && dpy[turnCount-2,y] == 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 1988 Byte
Status RE
Exec Time 694 ms
Memory 1989336 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
WA × 2
RE × 1
AC × 8
WA × 7
MLE × 33
RE × 8
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 WA 19 ms 9016 KB
0_01.txt RE 19 ms 10720 KB
0_02.txt AC 20 ms 9568 KB
0_03.txt AC 20 ms 11616 KB
0_04.txt WA 20 ms 10592 KB
0_05.txt AC 20 ms 12128 KB
1_00.txt AC 20 ms 11160 KB
1_01.txt AC 20 ms 13216 KB
1_02.txt WA 20 ms 13016 KB
1_03.txt WA 20 ms 13208 KB
1_04.txt WA 20 ms 10972 KB
1_05.txt RE 20 ms 13144 KB
1_06.txt MLE 378 ms 1012440 KB
1_07.txt MLE 377 ms 1010392 KB
1_08.txt MLE 491 ms 1346264 KB
1_09.txt MLE 491 ms 1346392 KB
1_10.txt MLE 488 ms 1346264 KB
1_11.txt MLE 489 ms 1346264 KB
1_12.txt MLE 255 ms 678744 KB
1_13.txt MLE 255 ms 676568 KB
1_14.txt MLE 371 ms 1012568 KB
1_15.txt MLE 370 ms 1012440 KB
1_16.txt MLE 369 ms 1012440 KB
1_17.txt MLE 368 ms 1010392 KB
1_18.txt MLE 371 ms 989912 KB
1_19.txt MLE 370 ms 991960 KB
1_20.txt MLE 369 ms 992088 KB
1_21.txt MLE 375 ms 1008472 KB
1_22.txt MLE 376 ms 1006296 KB
1_23.txt MLE 372 ms 994008 KB
1_24.txt MLE 378 ms 1016664 KB
1_25.txt MLE 371 ms 991960 KB
1_26.txt MLE 680 ms 1948376 KB
1_27.txt MLE 694 ms 1989336 KB
1_28.txt MLE 370 ms 987864 KB
1_29.txt MLE 374 ms 1008472 KB
1_30.txt MLE 205 ms 517080 KB
1_31.txt RE 194 ms 488280 KB
1_32.txt RE 115 ms 269144 KB
1_33.txt AC 112 ms 256728 KB
1_34.txt RE 66 ms 132056 KB
1_35.txt AC 64 ms 127704 KB
1_36.txt WA 45 ms 74456 KB
1_37.txt AC 50 ms 90840 KB
1_38.txt WA 33 ms 45784 KB
1_39.txt RE 33 ms 43864 KB
1_40.txt RE 26 ms 31576 KB
1_41.txt RE 27 ms 33624 KB
1_42.txt MLE 257 ms 682840 KB
1_43.txt MLE 256 ms 682840 KB
1_44.txt MLE 276 ms 684888 KB
1_45.txt MLE 264 ms 682840 KB
1_46.txt MLE 253 ms 680792 KB
1_47.txt MLE 260 ms 680792 KB
1_48.txt MLE 257 ms 678744 KB
1_49.txt MLE 267 ms 682968 KB