Submission #1997543
Source Code Expand
import java.util.Scanner; public class Main { public static int [] mvx = new int[8000]; public static int [] mvy = new int[8000]; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.next(); char [] sar = s.toCharArray(); int x = scanner.nextInt(); int y = scanner.nextInt(); int nx = 0; int ny = 0; char dir = 'x'; for (int i=0; i<sar.length; i++){ if (sar[i] == 'F'){ if (dir == 'x') { mvx[nx] = mvx[nx]+1; } else { mvy[ny] = mvy[ny]+1; } } else if (sar[i] == 'T') { if (dir == 'x') { nx++; mvx[nx] = 0; dir = 'y'; } else { ny++; mvy[ny] = 0; dir = 'x'; } } } if (sar[sar.length-1] == 'F') { if (dir == 'x') { nx++; } else { ny++; } } Boolean rslt = false; if (PosX(0, nx, x) && PosY(0, ny, y)) System.out.println("Yes"); else System.out.println("No"); } public static boolean PosX (int f, int e, int goal){ if (e == 1) if (mvx[e-1]==goal) return(true); else return(false); else{ if (PosX(0, e-1, goal+ mvx[e-1])) return(true); else if (PosX(0, e-1, goal - mvx[e-1])) return(true); } return(false); } public static boolean PosY (int f, int e, int goal){ if ((e == 1) && ((mvy[e-1]==goal) || (mvy[e-1]==-goal)) ) return(true); else{ if (PosY(0, e-1, goal+ mvy[e-1])) return(true); else if (PosY(0, e-1, goal - mvy[e-1])) return(true); } return(false); } }
Submission Info
Submission Time | |
---|---|
Task | D - FT Robot |
User | m5201204 |
Language | Java7 (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 2322 Byte |
Status | RE |
Exec Time | 2108 ms |
Memory | 24148 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 | 96 ms | 19028 KB |
0_01.txt | AC | 95 ms | 20436 KB |
0_02.txt | AC | 95 ms | 20820 KB |
0_03.txt | AC | 95 ms | 20820 KB |
0_04.txt | AC | 95 ms | 18900 KB |
0_05.txt | AC | 95 ms | 18900 KB |
1_00.txt | RE | 130 ms | 20180 KB |
1_01.txt | AC | 126 ms | 20052 KB |
1_02.txt | AC | 136 ms | 19924 KB |
1_03.txt | AC | 137 ms | 21844 KB |
1_04.txt | AC | 135 ms | 19924 KB |
1_05.txt | AC | 136 ms | 20052 KB |
1_06.txt | TLE | 2108 ms | 21184 KB |
1_07.txt | TLE | 2108 ms | 21076 KB |
1_08.txt | TLE | 2108 ms | 20772 KB |
1_09.txt | TLE | 2108 ms | 24148 KB |
1_10.txt | AC | 137 ms | 20308 KB |
1_11.txt | TLE | 2108 ms | 23104 KB |
1_12.txt | TLE | 2108 ms | 23076 KB |
1_13.txt | TLE | 2108 ms | 20644 KB |
1_14.txt | TLE | 2108 ms | 21076 KB |
1_15.txt | TLE | 2108 ms | 22848 KB |
1_16.txt | RE | 184 ms | 23124 KB |
1_17.txt | RE | 179 ms | 22356 KB |
1_18.txt | TLE | 2108 ms | 21076 KB |
1_19.txt | TLE | 2108 ms | 20768 KB |
1_20.txt | TLE | 2108 ms | 21844 KB |
1_21.txt | TLE | 2108 ms | 21204 KB |
1_22.txt | TLE | 2108 ms | 22100 KB |
1_23.txt | TLE | 2108 ms | 21204 KB |
1_24.txt | TLE | 2108 ms | 21204 KB |
1_25.txt | TLE | 2108 ms | 20436 KB |
1_26.txt | AC | 135 ms | 22356 KB |
1_27.txt | TLE | 2108 ms | 21408 KB |
1_28.txt | TLE | 2108 ms | 22100 KB |
1_29.txt | TLE | 2108 ms | 20672 KB |
1_30.txt | AC | 134 ms | 20308 KB |
1_31.txt | TLE | 2108 ms | 20180 KB |
1_32.txt | RE | 157 ms | 21332 KB |
1_33.txt | TLE | 2108 ms | 23764 KB |
1_34.txt | AC | 143 ms | 21972 KB |
1_35.txt | TLE | 2108 ms | 20820 KB |
1_36.txt | TLE | 2108 ms | 20308 KB |
1_37.txt | TLE | 2108 ms | 21024 KB |
1_38.txt | TLE | 2104 ms | 20468 KB |
1_39.txt | TLE | 2108 ms | 20052 KB |
1_40.txt | RE | 426 ms | 22944 KB |
1_41.txt | TLE | 2108 ms | 20052 KB |
1_42.txt | TLE | 2108 ms | 21076 KB |
1_43.txt | TLE | 2108 ms | 18388 KB |
1_44.txt | TLE | 2108 ms | 20308 KB |
1_45.txt | RE | 184 ms | 21440 KB |
1_46.txt | TLE | 2108 ms | 20436 KB |
1_47.txt | TLE | 2108 ms | 20948 KB |
1_48.txt | TLE | 2108 ms | 22592 KB |
1_49.txt | TLE | 2108 ms | 18388 KB |