Submission #64063128
Source Code Expand
Copy
#include<bits/stdc++.h>//#define int long long#define getchar_unlocked() getchar()using namespace std;inline int read() {int x=0,ff=1;char ch=getchar_unlocked();while(ch<48||ch>57) {if(ch==45)ff=-1;ch=getchar_unlocked();}while(ch>=48&&ch<=57) x=(x<<3)+(x<<1)+(ch^48),ch=getchar_unlocked();return x*ff;}inline void write(int x){if(!x){putchar(48),putchar('\n');return;}if(x<0)putchar(45),x=-x;char a[20];int i=0;while(x)a[++i]=x%10+48,x/=10;for(;i;i--)putchar(a[i]);putchar('\n');}const int N = 2e6 + 10;int n,m,nowx,nowy,lx=0,ly=0;map<pair<int,int>,bool >vv;signed main() {n = read();nowx = read();nowy = read();for(int i=1;i<=n;i++){char ch;cin>>ch;vv[{lx,ly}] = 1;if(ch=='N')nowx++,lx++;else if(ch=='S')nowx--,lx--;else if(ch=='W')nowy++,ly++;else if(ch=='E')nowy--,ly--;if(vv[{nowx,nowy}])cout<<1;else cout<<0;// cout<<nowx<<' '<<nowy<<' '<<lx<<' '<<ly<<'\n';
#include<bits/stdc++.h> //#define int long long #define getchar_unlocked() getchar() using namespace std; inline int read() {int x=0,ff=1;char ch=getchar_unlocked();while(ch<48||ch>57) {if(ch==45)ff=-1;ch=getchar_unlocked();}while(ch>=48&&ch<=57) x=(x<<3)+(x<<1)+(ch^48),ch=getchar_unlocked();return x*ff;} inline void write(int x){if(!x){putchar(48),putchar('\n');return;}if(x<0)putchar(45),x=-x;char a[20];int i=0;while(x)a[++i]=x%10+48,x/=10;for(;i;i--)putchar(a[i]);putchar('\n');} const int N = 2e6 + 10; int n,m,nowx,nowy,lx=0,ly=0; map<pair<int,int>,bool >vv; signed main() { n = read();nowx = read();nowy = read(); for(int i=1;i<=n;i++){ char ch;cin>>ch; vv[{lx,ly}] = 1; if(ch=='N')nowx++,lx++; else if(ch=='S')nowx--,lx--; else if(ch=='W')nowy++,ly++; else if(ch=='E')nowy--,ly--; if(vv[{nowx,nowy}])cout<<1; else cout<<0; // cout<<nowx<<' '<<nowy<<' '<<lx<<' '<<ly<<'\n'; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Bonfire |
User | nzy2011 |
Language | C++ 17 (gcc 12.2) |
Score | 425 |
Code Size | 941 Byte |
Status | AC |
Exec Time | 302 ms |
Memory | 28676 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 425 / 425 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 3556 KB |
sample_02.txt | AC | 1 ms | 3404 KB |
sample_03.txt | AC | 1 ms | 3676 KB |
test_01.txt | AC | 223 ms | 6528 KB |
test_02.txt | AC | 225 ms | 6992 KB |
test_03.txt | AC | 223 ms | 6896 KB |
test_04.txt | AC | 1 ms | 3528 KB |
test_05.txt | AC | 224 ms | 6796 KB |
test_06.txt | AC | 231 ms | 9012 KB |
test_07.txt | AC | 226 ms | 7324 KB |
test_08.txt | AC | 1 ms | 3532 KB |
test_09.txt | AC | 230 ms | 8096 KB |
test_10.txt | AC | 227 ms | 7068 KB |
test_11.txt | AC | 227 ms | 7164 KB |
test_12.txt | AC | 1 ms | 3448 KB |
test_13.txt | AC | 230 ms | 8796 KB |
test_14.txt | AC | 232 ms | 9728 KB |
test_15.txt | AC | 232 ms | 9768 KB |
test_16.txt | AC | 5 ms | 3636 KB |
test_17.txt | AC | 229 ms | 8784 KB |
test_18.txt | AC | 234 ms | 9544 KB |
test_19.txt | AC | 231 ms | 8820 KB |
test_20.txt | AC | 47 ms | 4840 KB |
test_21.txt | AC | 232 ms | 9644 KB |
test_22.txt | AC | 228 ms | 8184 KB |
test_23.txt | AC | 232 ms | 8964 KB |
test_24.txt | AC | 232 ms | 9228 KB |
test_25.txt | AC | 285 ms | 28476 KB |
test_26.txt | AC | 270 ms | 28608 KB |
test_27.txt | AC | 288 ms | 28480 KB |
test_28.txt | AC | 273 ms | 28408 KB |
test_29.txt | AC | 293 ms | 28532 KB |
test_30.txt | AC | 295 ms | 28536 KB |
test_31.txt | AC | 293 ms | 28472 KB |
test_32.txt | AC | 291 ms | 28532 KB |
test_33.txt | AC | 299 ms | 28484 KB |
test_34.txt | AC | 278 ms | 28484 KB |
test_35.txt | AC | 302 ms | 28492 KB |
test_36.txt | AC | 275 ms | 28528 KB |
test_37.txt | AC | 296 ms | 28448 KB |
test_38.txt | AC | 296 ms | 28532 KB |
test_39.txt | AC | 294 ms | 28676 KB |
test_40.txt | AC | 293 ms | 28412 KB |
test_41.txt | AC | 251 ms | 14556 KB |
test_42.txt | AC | 254 ms | 23768 KB |
test_43.txt | AC | 254 ms | 28284 KB |
test_44.txt | AC | 278 ms | 27840 KB |
test_45.txt | AC | 247 ms | 17168 KB |
test_46.txt | AC | 249 ms | 13528 KB |
test_47.txt | AC | 248 ms | 18744 KB |
test_48.txt | AC | 244 ms | 15448 KB |
test_49.txt | AC | 256 ms | 23852 KB |
test_50.txt | AC | 270 ms | 23584 KB |
test_51.txt | AC | 250 ms | 18440 KB |
test_52.txt | AC | 251 ms | 18984 KB |
test_53.txt | AC | 253 ms | 16956 KB |
test_54.txt | AC | 254 ms | 27488 KB |
test_55.txt | AC | 259 ms | 26600 KB |
test_56.txt | AC | 257 ms | 24644 KB |
test_57.txt | AC | 255 ms | 24500 KB |
test_58.txt | AC | 245 ms | 19836 KB |
test_59.txt | AC | 242 ms | 17164 KB |
test_60.txt | AC | 242 ms | 19680 KB |