Submission #2852800
Source Code Expand
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int px[6] = { 0,1,-1,1,0,1 }, py[6] = { -1,-1,0,0,1,1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second
bool dpx[16000][8000], dpy[16000][8000];
int main() {
string s;
int x, y, now = 8000, fl = 2;
cin >> s >> x >> y;
dpx[8000][0] = true, dpy[8000][0] = true;
x += 8000, y += 8000;
for (int i = 0;i < s.size();i++) {
if (fl == 2 && s[i] == 'F') {
dpx[now + 1][i+1] = true;
dpy[8000][i+1] = true;
now++;
}
else if (fl == 2 && s[i] == 'T') {
fl = 1;
dpx[now][i+1] = true;
dpy[8000][i+1] = true;
}
else if (fl == 1 && s[i] == 'F') {
for (int j = 0;j <= 16000;j++) {
if (dpy[j][i])dpy[j + 1][i+1] = true, dpy[j - 1][i+1] = true;
}
for (int j = 0;j <= 16000;j++) {
if (dpx[j][i])dpx[j][i+1] = true;
}
}
else if (fl == 1 && s[i] == 'T') {
fl = 0;
for (int j = 0;j <= 16000;j++) {
if (dpy[j][i])dpy[j][i+1] = true;
}
for (int j = 0;j <= 16000;j++) {
if (dpx[j][i])dpx[j][i+1] = true;
}
}
else if (fl == 0 && s[i] == 'F') {
for (int j = 0;j <= 16000;j++) {
if (dpx[j][i])dpx[j + 1][i+1] = true, dpx[j - 1][i+1] = true;
}
for (int j = 0;j <= 16000;j++) {
if (dpy[j][i])dpy[j][i+1] = true;
}
}
else if (fl == 0 && s[i] == 'T') {
for (int j = 0;j <= 16000;j++) {
if (dpx[j][i])dpx[j][i+1] = true;
}
for (int j = 0;j <= 16000;j++) {
if (dpy[j][i])dpy[j][i+1] = true;
}
}
}
if (dpx[x][(int)s.size()] && dpy[y][(int)s.size()])cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
D - FT Robot |
User |
kakakakaneko |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
2394 Byte |
Status |
RE |
Exec Time |
318 ms |
Memory |
65920 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:76:17: warning: iteration 16000u invokes undefined behavior [-Waggressive-loop-optimizations]
if (dpx[j][i])dpx[j + 1][i+1] = true, dpx[j - 1][i+1] = true;
^
./Main.cpp:75:21: note: containing loop
for (int j = 0;j <= 16000;j++) {
^
./Main.cpp:59:17: warning: iteration 16000u invokes undefined behavior [-Waggressive-loop-optimizations]
if (dpy[j][i])dpy[j + 1][i+1] = true, dpy[j - 1][i+1] = true;
^
./Main.cpp:58:21: note: containing loop
for (int j = 0;j <= 16000;j++) {
^
./Main.cpp:62:17: warning: iteration 16000u invokes undefined behavior [-Waggressive-loop-optimizations]
if (dpx[j][i])dpx[j][i+1] = true;
^
./Main.cpp:61:21: note: containing loop
for (int j = 0;j <= 16000;j++) {
^
./Main.cpp:71:17: warning: iteration 16000u invokes undefined behavior [-Waggressive-loop-optimizations]
if (dpx[j][i])dpx[j][i+1]...
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 |
3 ms |
4352 KB |
0_01.txt |
AC |
3 ms |
4352 KB |
0_02.txt |
AC |
2 ms |
4352 KB |
0_03.txt |
AC |
3 ms |
4352 KB |
0_04.txt |
AC |
3 ms |
4352 KB |
0_05.txt |
AC |
3 ms |
4352 KB |
1_00.txt |
RE |
111 ms |
65920 KB |
1_01.txt |
RE |
112 ms |
65920 KB |
1_02.txt |
RE |
317 ms |
57600 KB |
1_03.txt |
RE |
318 ms |
57600 KB |
1_04.txt |
RE |
317 ms |
57600 KB |
1_05.txt |
RE |
318 ms |
57600 KB |
1_06.txt |
RE |
304 ms |
28928 KB |
1_07.txt |
RE |
305 ms |
28928 KB |
1_08.txt |
RE |
302 ms |
20736 KB |
1_09.txt |
RE |
303 ms |
20736 KB |
1_10.txt |
RE |
302 ms |
20736 KB |
1_11.txt |
RE |
302 ms |
20736 KB |
1_12.txt |
RE |
310 ms |
37120 KB |
1_13.txt |
RE |
307 ms |
37120 KB |
1_14.txt |
RE |
303 ms |
28928 KB |
1_15.txt |
RE |
303 ms |
28928 KB |
1_16.txt |
RE |
304 ms |
28928 KB |
1_17.txt |
RE |
303 ms |
28928 KB |
1_18.txt |
RE |
305 ms |
28928 KB |
1_19.txt |
RE |
304 ms |
28928 KB |
1_20.txt |
RE |
304 ms |
28928 KB |
1_21.txt |
RE |
304 ms |
28928 KB |
1_22.txt |
RE |
304 ms |
28928 KB |
1_23.txt |
RE |
304 ms |
28928 KB |
1_24.txt |
RE |
304 ms |
28928 KB |
1_25.txt |
RE |
305 ms |
30976 KB |
1_26.txt |
RE |
296 ms |
4352 KB |
1_27.txt |
RE |
296 ms |
4352 KB |
1_28.txt |
RE |
305 ms |
28928 KB |
1_29.txt |
RE |
305 ms |
28928 KB |
1_30.txt |
RE |
309 ms |
41216 KB |
1_31.txt |
RE |
309 ms |
43264 KB |
1_32.txt |
RE |
312 ms |
49408 KB |
1_33.txt |
RE |
313 ms |
49408 KB |
1_34.txt |
RE |
313 ms |
53504 KB |
1_35.txt |
RE |
313 ms |
53504 KB |
1_36.txt |
RE |
308 ms |
51456 KB |
1_37.txt |
RE |
309 ms |
51456 KB |
1_38.txt |
RE |
312 ms |
53504 KB |
1_39.txt |
RE |
317 ms |
53504 KB |
1_40.txt |
RE |
316 ms |
53504 KB |
1_41.txt |
RE |
310 ms |
55552 KB |
1_42.txt |
RE |
296 ms |
51456 KB |
1_43.txt |
RE |
310 ms |
55552 KB |
1_44.txt |
RE |
311 ms |
55552 KB |
1_45.txt |
RE |
289 ms |
49408 KB |
1_46.txt |
RE |
316 ms |
57600 KB |
1_47.txt |
RE |
314 ms |
57600 KB |
1_48.txt |
RE |
313 ms |
55552 KB |
1_49.txt |
RE |
316 ms |
57600 KB |