Submission #2012867
Source Code Expand
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define db long double #define ii pair<int,int> #define vi vector<int> #define fi first #define se second #define sz(a) (int)(a).size() #define all(a) (a).begin(),(a).end() #define pb push_back #define mp make_pair #define FN(i, n) for (int i = 0; i < (int)(n); ++i) #define FEN(i,n) for (int i = 1;i <= (int)(n); ++i) #define rep(i,a,b) for(int i=a;i<b;i++) #define repv(i,a,b) for(int i=b-1;i>=a;i--) #define SET(A, val) memset(A, val, sizeof(A)) typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ; // order_of_key (val): returns the no. of values less than val // find_by_order (k): returns the kth largest element.(0-based) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define trace(...) #endif const int N=8005; vi x1,y2; int dp1[2][4*N],dp2[2][4*N]; int main() { std::ios::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL) ; string s; int x,y; cin>>s>>x>>y; s+="T"; int cnt=0,side=1; rep(i,0,sz(s)) { if(s[i]=='T') { if(cnt) { if(side) x1.pb(cnt); else y2.pb(cnt); } side=1-side; cnt=0; } else cnt++; } dp1[0][N]=1; int bit1=1; for(auto it:x1) { rep(i,0,N) if(dp1[1-bit1][i+N]) dp1[bit1][i+it+N]=dp1[bit1][i-it+N]=1; rep(i,0,4*N) dp1[1-bit1][i]=0; bit1=1-bit1; } int bit2=1; dp2[0][N]=1; for(auto it:y2) { rep(i,0,N) if(dp2[1-bit2][i+N]) dp2[bit2][i+it+N]=dp2[bit2][i-it+N]=1; rep(i,0,4*N) dp2[1-bit2][i]=0; bit2=1-bit2; } if(dp1[1-bit1][x+N] && dp2[1-bit2][y+N]) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0 ; }
Submission Info
Submission Time | |
---|---|
Task | D - FT Robot |
User | born2rule |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2280 Byte |
Status | WA |
Exec Time | 70 ms |
Memory | 768 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 | 640 KB |
0_01.txt | AC | 1 ms | 640 KB |
0_02.txt | AC | 1 ms | 384 KB |
0_03.txt | AC | 1 ms | 384 KB |
0_04.txt | AC | 1 ms | 512 KB |
0_05.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 384 KB |
1_01.txt | WA | 1 ms | 384 KB |
1_02.txt | AC | 1 ms | 384 KB |
1_03.txt | AC | 1 ms | 384 KB |
1_04.txt | AC | 1 ms | 384 KB |
1_05.txt | AC | 1 ms | 384 KB |
1_06.txt | WA | 70 ms | 768 KB |
1_07.txt | AC | 70 ms | 768 KB |
1_08.txt | AC | 48 ms | 512 KB |
1_09.txt | AC | 48 ms | 512 KB |
1_10.txt | WA | 46 ms | 512 KB |
1_11.txt | AC | 47 ms | 512 KB |
1_12.txt | WA | 47 ms | 768 KB |
1_13.txt | AC | 47 ms | 768 KB |
1_14.txt | WA | 35 ms | 512 KB |
1_15.txt | AC | 36 ms | 512 KB |
1_16.txt | WA | 35 ms | 512 KB |
1_17.txt | AC | 35 ms | 512 KB |
1_18.txt | WA | 34 ms | 768 KB |
1_19.txt | AC | 35 ms | 768 KB |
1_20.txt | WA | 35 ms | 768 KB |
1_21.txt | AC | 35 ms | 768 KB |
1_22.txt | WA | 36 ms | 768 KB |
1_23.txt | AC | 35 ms | 768 KB |
1_24.txt | WA | 35 ms | 768 KB |
1_25.txt | AC | 36 ms | 768 KB |
1_26.txt | AC | 1 ms | 256 KB |
1_27.txt | AC | 1 ms | 256 KB |
1_28.txt | AC | 35 ms | 768 KB |
1_29.txt | AC | 35 ms | 768 KB |
1_30.txt | WA | 28 ms | 768 KB |
1_31.txt | AC | 26 ms | 768 KB |
1_32.txt | WA | 17 ms | 768 KB |
1_33.txt | AC | 16 ms | 768 KB |
1_34.txt | WA | 9 ms | 768 KB |
1_35.txt | AC | 9 ms | 768 KB |
1_36.txt | AC | 6 ms | 768 KB |
1_37.txt | AC | 6 ms | 768 KB |
1_38.txt | AC | 4 ms | 768 KB |
1_39.txt | AC | 4 ms | 768 KB |
1_40.txt | WA | 3 ms | 768 KB |
1_41.txt | AC | 3 ms | 768 KB |
1_42.txt | AC | 24 ms | 768 KB |
1_43.txt | AC | 24 ms | 768 KB |
1_44.txt | AC | 24 ms | 768 KB |
1_45.txt | AC | 24 ms | 768 KB |
1_46.txt | AC | 25 ms | 768 KB |
1_47.txt | AC | 25 ms | 768 KB |
1_48.txt | AC | 25 ms | 768 KB |
1_49.txt | AC | 24 ms | 768 KB |