Submission #2852835
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[24000][8000], dpy[24000][8000]; int main() { string s; int x, y, now = 12000, fl = 2; cin >> s >> x >> y; dpx[12000][0] = true, dpy[12000][0] = true; x += 12000, y += 12000; for (int i = 0;i < s.size();i++) { if (fl == 2 && s[i] == 'F') { dpx[now + 1][i+1] = true; dpy[12000][i+1] = true; now++; } else if (fl == 2 && s[i] == 'T') { fl = 1; dpx[now][i+1] = true; dpy[12000][i+1] = true; } else if (fl == 1 && s[i] == 'F') { for (int j = 4000;j <= 20000;j++) { if (dpy[j][i])dpy[j + 1][i+1] = true, dpy[j - 1][i+1] = true; } for (int j = 4000;j <= 20000;j++) { if (dpx[j][i])dpx[j][i+1] = true; } } else if (fl == 1 && s[i] == 'T') { fl = 0; for (int j = 4000;j <= 20000;j++) { if (dpy[j][i])dpy[j][i+1] = true; } for (int j = 4000;j <= 20000;j++) { if (dpx[j][i])dpx[j][i+1] = true; } } else if (fl == 0 && s[i] == 'F') { for (int j = 4000;j <= 20000;j++) { if (dpx[j][i])dpx[j + 1][i+1] = true, dpx[j - 1][i+1] = true; } for (int j = 4000;j <= 20000;j++) { if (dpy[j][i])dpy[j][i+1] = true; } } else if (fl == 0 && s[i] == 'T') { fl = 1; for (int j = 4000;j <= 20000;j++) { if (dpx[j][i])dpx[j][i+1] = true; } for (int j = 4000;j <= 20000;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 | 2437 Byte |
Status | WA |
Exec Time | 572 ms |
Memory | 129280 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 | 3 ms | 4352 KB |
0_01.txt | AC | 3 ms | 4352 KB |
0_02.txt | AC | 2 ms | 4352 KB |
0_03.txt | AC | 2 ms | 4352 KB |
0_04.txt | AC | 2 ms | 4352 KB |
0_05.txt | AC | 2 ms | 4352 KB |
1_00.txt | AC | 14 ms | 65792 KB |
1_01.txt | AC | 14 ms | 65792 KB |
1_02.txt | AC | 571 ms | 129280 KB |
1_03.txt | AC | 571 ms | 129280 KB |
1_04.txt | AC | 572 ms | 129280 KB |
1_05.txt | AC | 571 ms | 129280 KB |
1_06.txt | AC | 510 ms | 65792 KB |
1_07.txt | AC | 512 ms | 65792 KB |
1_08.txt | AC | 506 ms | 45312 KB |
1_09.txt | AC | 505 ms | 45312 KB |
1_10.txt | AC | 505 ms | 45312 KB |
1_11.txt | AC | 505 ms | 45312 KB |
1_12.txt | AC | 528 ms | 86272 KB |
1_13.txt | WA | 526 ms | 86272 KB |
1_14.txt | AC | 511 ms | 65792 KB |
1_15.txt | AC | 511 ms | 65792 KB |
1_16.txt | AC | 511 ms | 67840 KB |
1_17.txt | WA | 512 ms | 67840 KB |
1_18.txt | AC | 509 ms | 67840 KB |
1_19.txt | AC | 509 ms | 65792 KB |
1_20.txt | AC | 505 ms | 63744 KB |
1_21.txt | AC | 514 ms | 65792 KB |
1_22.txt | AC | 511 ms | 65792 KB |
1_23.txt | AC | 512 ms | 67840 KB |
1_24.txt | AC | 510 ms | 63744 KB |
1_25.txt | AC | 514 ms | 67840 KB |
1_26.txt | AC | 471 ms | 4352 KB |
1_27.txt | AC | 481 ms | 4352 KB |
1_28.txt | AC | 511 ms | 67840 KB |
1_29.txt | AC | 513 ms | 67840 KB |
1_30.txt | AC | 524 ms | 96512 KB |
1_31.txt | AC | 520 ms | 96512 KB |
1_32.txt | AC | 539 ms | 112896 KB |
1_33.txt | AC | 543 ms | 112896 KB |
1_34.txt | AC | 533 ms | 119040 KB |
1_35.txt | AC | 542 ms | 121088 KB |
1_36.txt | AC | 520 ms | 119040 KB |
1_37.txt | AC | 537 ms | 121088 KB |
1_38.txt | AC | 550 ms | 129280 KB |
1_39.txt | AC | 554 ms | 127232 KB |
1_40.txt | AC | 548 ms | 125184 KB |
1_41.txt | WA | 547 ms | 127232 KB |
1_42.txt | AC | 514 ms | 82176 KB |
1_43.txt | WA | 527 ms | 86272 KB |
1_44.txt | AC | 525 ms | 86272 KB |
1_45.txt | AC | 500 ms | 80128 KB |
1_46.txt | WA | 532 ms | 88320 KB |
1_47.txt | AC | 534 ms | 88320 KB |
1_48.txt | AC | 532 ms | 88320 KB |
1_49.txt | AC | 534 ms | 88320 KB |