Submission #3027546
Source Code Expand
#include <iostream> #include <algorithm> #include <utility> #include <vector> #include <string> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n) - 1; i >= 0; i--) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (a); i > (b); i--) #define ALL(a) (a).begin(), (a).end() bool check(vector<int> vi, int n) { bool dp[2][20000]; bool *prev = dp[0], *next = dp[1]; fill(prev, prev + 20000, false); prev[vi[0] + 10000] = true; FOR(i, 1, vi.size()) { REP(j, 20000) { if (prev[j]) { next[j + vi[i]] = true; next[j - vi[i]] = true; } } swap(prev, next); } return prev[n + 10000]; } int main() { string s; int x, y; cin >> s >> x >> y; s += 'T'; vector<int> hv, vv; int count = 0; bool horizontal = true; REP(i, s.length()) { if (s[i] == 'T') { if (horizontal) hv.push_back(count); else vv.push_back(count); horizontal = !horizontal; count = 0; } else count++; } bool okh = false, okv = false; if (hv.size() == 0) { okh |= x == 0; } else { okh |= check(hv, x); } if (vv.size() == 0) { okv |= y == 0; } else { okv |= check(vv, y); vv[0] *= -1; okv |= check(vv, y); } if (okh && okv) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - FT Robot |
User | shiita0903 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1690 Byte |
Status | RE |
Exec Time | 189 ms |
Memory | 384 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 | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
0_04.txt | AC | 1 ms | 256 KB |
0_05.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | AC | 1 ms | 256 KB |
1_05.txt | AC | 1 ms | 256 KB |
1_06.txt | AC | 119 ms | 256 KB |
1_07.txt | AC | 119 ms | 384 KB |
1_08.txt | AC | 151 ms | 384 KB |
1_09.txt | AC | 151 ms | 384 KB |
1_10.txt | AC | 146 ms | 384 KB |
1_11.txt | AC | 146 ms | 384 KB |
1_12.txt | AC | 78 ms | 384 KB |
1_13.txt | WA | 77 ms | 256 KB |
1_14.txt | AC | 113 ms | 384 KB |
1_15.txt | AC | 113 ms | 384 KB |
1_16.txt | AC | 109 ms | 256 KB |
1_17.txt | WA | 109 ms | 384 KB |
1_18.txt | RE | 133 ms | 256 KB |
1_19.txt | RE | 177 ms | 256 KB |
1_20.txt | RE | 131 ms | 256 KB |
1_21.txt | RE | 134 ms | 256 KB |
1_22.txt | RE | 134 ms | 256 KB |
1_23.txt | RE | 132 ms | 256 KB |
1_24.txt | RE | 177 ms | 256 KB |
1_25.txt | RE | 132 ms | 256 KB |
1_26.txt | AC | 185 ms | 384 KB |
1_27.txt | AC | 189 ms | 384 KB |
1_28.txt | RE | 132 ms | 256 KB |
1_29.txt | RE | 132 ms | 256 KB |
1_30.txt | RE | 116 ms | 256 KB |
1_31.txt | RE | 115 ms | 256 KB |
1_32.txt | RE | 107 ms | 256 KB |
1_33.txt | RE | 107 ms | 256 KB |
1_34.txt | RE | 101 ms | 256 KB |
1_35.txt | RE | 101 ms | 256 KB |
1_36.txt | RE | 99 ms | 256 KB |
1_37.txt | RE | 100 ms | 256 KB |
1_38.txt | RE | 98 ms | 256 KB |
1_39.txt | RE | 98 ms | 256 KB |
1_40.txt | RE | 97 ms | 256 KB |
1_41.txt | RE | 97 ms | 256 KB |
1_42.txt | RE | 139 ms | 256 KB |
1_43.txt | RE | 137 ms | 256 KB |
1_44.txt | RE | 129 ms | 256 KB |
1_45.txt | RE | 134 ms | 256 KB |
1_46.txt | RE | 150 ms | 256 KB |
1_47.txt | RE | 153 ms | 256 KB |
1_48.txt | RE | 152 ms | 256 KB |
1_49.txt | RE | 154 ms | 256 KB |