Submission #60948781
Source Code Expand
Copy
#include <bits/stdc++.h>#include<ext/pb_ds/assoc_container.hpp>#include<ext/pb_ds/tree_policy.hpp>#include <ext/rope>using namespace __gnu_pbds;using namespace std;#define pb push_back#define rep(i,x,y) for(register int i=x;i<=y;i++)#define rep1(i,x,y) for(register int i=x;i>=y;--i)#define int long long#define fire signed#define il inlinetemplate<class T> il void print(T x) {if(x<0) printf("-"),x=-x;if (x > 9) print(x / 10);putchar(x % 10 + '0');}template<class T> il void in(T &x) {x = 0; char ch = getchar();int f = 1;while (ch < '0' || ch > '9') {if(ch=='-') f = -1; ch = getchar(); }
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace std; #define pb push_back #define rep(i,x,y) for(register int i=x;i<=y;i++) #define rep1(i,x,y) for(register int i=x;i>=y;--i) #define int long long #define fire signed #define il inline template<class T> il void print(T x) { if(x<0) printf("-"),x=-x; if (x > 9) print(x / 10); putchar(x % 10 + '0'); } template<class T> il void in(T &x) { x = 0; char ch = getchar(); int f = 1; while (ch < '0' || ch > '9') {if(ch=='-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } x *= f; } int T=1; int n; const int N=3e3+10; int h[N],vis[N][N]; string t; char s[N][N]; int m,x,y; void solve() { in(n),in(m),in(x),in(y); rep(i,1,n) rep(j,1,m) cin>>s[i][j]; cin>>t; int w=t.size(),res=0; t=" "+t; rep(i,1,w){ if(t[i]=='R'){ if(y+1>m||s[x][y+1]=='#') continue; ++y; } if(t[i]=='D'){ if(x+1>n||s[x+1][y]=='#') continue; ++x; } if(t[i]=='U'){ if(x-1<1||s[x-1][y]=='#') continue; --x; } if(t[i]=='L'){ if(y-1<1||s[x][y-1]=='#') continue; --y; } if(s[x][y]=='@') res+=(!vis[x][y]); vis[x][y]=1; } cout<<x<<' '<<y<<' '<<res; } fire main() { while(T--) { solve(); } return false; }
Submission Info
Submission Time | |
---|---|
Task | B - Santa Claus 1 |
User | zhy091206 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 1441 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 4212 KB |
Compile Error
Main.cpp: In function ‘void solve()’: Main.cpp:34:13: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 34 | rep(i,1,n) rep(j,1,m) cin>>s[i][j]; | ^ Main.cpp:8:37: note: in definition of macro ‘rep’ 8 | #define rep(i,x,y) for(register int i=x;i<=y;i++) | ^ Main.cpp:34:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 34 | rep(i,1,n) rep(j,1,m) cin>>s[i][j]; | ^ Main.cpp:8:37: note: in definition of macro ‘rep’ 8 | #define rep(i,x,y) for(register int i=x;i<=y;i++) | ^ Main.cpp:38:13: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 38 | rep(i,1,w){ | ^ Main.cpp:8:37: note: in definition of macro ‘rep’ 8 | #define rep(i,x,y) for(register int i=x;i<=y;i++) | ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 2 ms | 3536 KB |
hand_02.txt | AC | 1 ms | 3680 KB |
random_01.txt | AC | 2 ms | 4112 KB |
random_02.txt | AC | 1 ms | 3856 KB |
random_03.txt | AC | 1 ms | 3788 KB |
random_04.txt | AC | 2 ms | 3852 KB |
random_05.txt | AC | 1 ms | 3668 KB |
random_06.txt | AC | 1 ms | 3964 KB |
random_07.txt | AC | 1 ms | 3988 KB |
random_08.txt | AC | 1 ms | 3812 KB |
random_09.txt | AC | 2 ms | 3796 KB |
random_10.txt | AC | 1 ms | 4000 KB |
random_11.txt | AC | 2 ms | 3860 KB |
random_12.txt | AC | 1 ms | 3768 KB |
random_13.txt | AC | 2 ms | 4212 KB |
sample_01.txt | AC | 1 ms | 3588 KB |
sample_02.txt | AC | 1 ms | 3548 KB |
sample_03.txt | AC | 1 ms | 3524 KB |