Submission #4559564
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>; using LL = long long;
using VI = vector<int>; using VVI = vector<VI>;
using PII = pair<int, int>; using PLL = pair<LL, LL>;
using VL = vector<LL>; using VVL = vector<VL>;
#define ALL(a) begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3")
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x)
#endif
const int INF = 1e9; const LL LINF = 1e16;
const LL MOD = 1000000007; const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 }; int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
/* ----- 2019/03/12 Problem: ABC 082 D / Link: http://abc082.contest.atcoder.jp/tasks/abc082_d ----- */
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
string s; cin >> s;
int x, y; cin >> x >> y;
VVI poss(2, VI(1, 0));
{
int mode = 0;
for (auto c : s) {
if (c == 'F') {
poss[mode].back()++;
}
else {
poss[mode].push_back(0);
mode ^= 1;
}
}
}
const int base = 10000;
auto f = [](const VI& xs, bool first) {
bitset<2 * base>a;
a[base] = 1;
FOR(i, 0, SZ(xs)) {
int dx = xs[i];
bitset<2 * base>nx;
nx |= a << dx;
if (i || first)nx |= a >> dx;
a = nx;
}
return a;
};
auto X = f(poss[0], 0);
auto Y = f(poss[1], 1);
cout << (X[base + x] && Y[base + y] ? "Yes" : "No") << "\n";
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - FT Robot |
| User | Yang33 |
| Language | C++14 (GCC 5.4.1) |
| Score | 500 |
| Code Size | 1775 Byte |
| Status | AC |
| Exec Time | 8 ms |
| Memory | 384 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 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 KiB |
| 0_01.txt | AC | 1 ms | 256 KiB |
| 0_02.txt | AC | 1 ms | 256 KiB |
| 0_03.txt | AC | 1 ms | 256 KiB |
| 0_04.txt | AC | 1 ms | 256 KiB |
| 0_05.txt | AC | 1 ms | 256 KiB |
| 1_00.txt | AC | 1 ms | 256 KiB |
| 1_01.txt | AC | 1 ms | 256 KiB |
| 1_02.txt | AC | 1 ms | 256 KiB |
| 1_03.txt | AC | 1 ms | 256 KiB |
| 1_04.txt | AC | 1 ms | 256 KiB |
| 1_05.txt | AC | 1 ms | 256 KiB |
| 1_06.txt | AC | 8 ms | 256 KiB |
| 1_07.txt | AC | 8 ms | 256 KiB |
| 1_08.txt | AC | 8 ms | 384 KiB |
| 1_09.txt | AC | 8 ms | 384 KiB |
| 1_10.txt | AC | 8 ms | 384 KiB |
| 1_11.txt | AC | 8 ms | 384 KiB |
| 1_12.txt | AC | 6 ms | 256 KiB |
| 1_13.txt | AC | 6 ms | 256 KiB |
| 1_14.txt | AC | 6 ms | 256 KiB |
| 1_15.txt | AC | 6 ms | 256 KiB |
| 1_16.txt | AC | 6 ms | 256 KiB |
| 1_17.txt | AC | 6 ms | 256 KiB |
| 1_18.txt | AC | 6 ms | 256 KiB |
| 1_19.txt | AC | 6 ms | 256 KiB |
| 1_20.txt | AC | 6 ms | 256 KiB |
| 1_21.txt | AC | 6 ms | 256 KiB |
| 1_22.txt | AC | 6 ms | 256 KiB |
| 1_23.txt | AC | 6 ms | 256 KiB |
| 1_24.txt | AC | 6 ms | 256 KiB |
| 1_25.txt | AC | 6 ms | 256 KiB |
| 1_26.txt | AC | 8 ms | 384 KiB |
| 1_27.txt | AC | 8 ms | 384 KiB |
| 1_28.txt | AC | 6 ms | 256 KiB |
| 1_29.txt | AC | 6 ms | 256 KiB |
| 1_30.txt | AC | 4 ms | 256 KiB |
| 1_31.txt | AC | 4 ms | 256 KiB |
| 1_32.txt | AC | 3 ms | 256 KiB |
| 1_33.txt | AC | 3 ms | 256 KiB |
| 1_34.txt | AC | 2 ms | 256 KiB |
| 1_35.txt | AC | 2 ms | 256 KiB |
| 1_36.txt | AC | 2 ms | 256 KiB |
| 1_37.txt | AC | 2 ms | 256 KiB |
| 1_38.txt | AC | 1 ms | 256 KiB |
| 1_39.txt | AC | 1 ms | 256 KiB |
| 1_40.txt | AC | 1 ms | 256 KiB |
| 1_41.txt | AC | 1 ms | 256 KiB |
| 1_42.txt | AC | 5 ms | 256 KiB |
| 1_43.txt | AC | 5 ms | 256 KiB |
| 1_44.txt | AC | 5 ms | 256 KiB |
| 1_45.txt | AC | 5 ms | 256 KiB |
| 1_46.txt | AC | 5 ms | 256 KiB |
| 1_47.txt | AC | 5 ms | 256 KiB |
| 1_48.txt | AC | 5 ms | 256 KiB |
| 1_49.txt | AC | 5 ms | 256 KiB |