# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101838 | 2019-03-20T12:46:18 Z | rainy | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 299684 KB |
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int H,W; char gr[4005][4005],ca,idk='a'; int vis[4005][4005]; int dx[]={0,1,0,-1},dy[]={1,0,-1,0}; void dfs(int x,int y){ for(int i=0;i<4;i++){ int nx=x+dx[i],ny=y+dy[i]; if(0<=nx&&nx<H&&0<=ny&&ny<W){ if(!vis[nx][ny]&&(gr[nx][ny]==ca||gr[nx][ny]==idk)){ vis[nx][ny]=1; gr[nx][ny]=idk; dfs(nx,ny); } } } } int main(){ scanf("%d%d",&H,&W); for(int i=0;i<H;i++){ for(int j=0;j<W;j++)scanf(" %c",&gr[i][j]); } ca=gr[0][0]; int ans=0; while(true){ ans++; memset(vis,0,sizeof(vis)); dfs(0,0); if(ca=='F')ca='R'; else ca='F'; bool isD=true; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(gr[i][j]=='F'||gr[i][j]=='R')isD=false; } } if(isD)break; } printf("%d\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 892 ms | 71480 KB | Output is correct |
2 | Execution timed out | 2047 ms | 63096 KB | Time limit exceeded |
3 | Correct | 569 ms | 63356 KB | Output is correct |
4 | Correct | 148 ms | 69924 KB | Output is correct |
5 | Correct | 1534 ms | 64592 KB | Output is correct |
6 | Execution timed out | 2028 ms | 63096 KB | Time limit exceeded |
7 | Correct | 569 ms | 63456 KB | Output is correct |
8 | Correct | 132 ms | 63588 KB | Output is correct |
9 | Correct | 775 ms | 63636 KB | Output is correct |
10 | Execution timed out | 2024 ms | 64468 KB | Time limit exceeded |
11 | Correct | 101 ms | 65144 KB | Output is correct |
12 | Correct | 613 ms | 66616 KB | Output is correct |
13 | Correct | 1544 ms | 64540 KB | Output is correct |
14 | Correct | 1594 ms | 64592 KB | Output is correct |
15 | Execution timed out | 2045 ms | 68176 KB | Time limit exceeded |
16 | Correct | 932 ms | 71360 KB | Output is correct |
17 | Execution timed out | 2041 ms | 67448 KB | Time limit exceeded |
18 | Correct | 157 ms | 69880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2041 ms | 78332 KB | Time limit exceeded |
2 | Execution timed out | 2060 ms | 71356 KB | Time limit exceeded |
3 | Execution timed out | 2041 ms | 93304 KB | Time limit exceeded |
4 | Execution timed out | 2041 ms | 75988 KB | Time limit exceeded |
5 | Execution timed out | 2045 ms | 83936 KB | Time limit exceeded |
6 | Execution timed out | 2050 ms | 124760 KB | Time limit exceeded |
7 | Execution timed out | 2031 ms | 78840 KB | Time limit exceeded |
8 | Execution timed out | 2044 ms | 78328 KB | Time limit exceeded |
9 | Execution timed out | 2020 ms | 63928 KB | Time limit exceeded |
10 | Execution timed out | 2025 ms | 63224 KB | Time limit exceeded |
11 | Execution timed out | 2013 ms | 78584 KB | Time limit exceeded |
12 | Execution timed out | 2048 ms | 63736 KB | Time limit exceeded |
13 | Execution timed out | 2052 ms | 71376 KB | Time limit exceeded |
14 | Execution timed out | 2024 ms | 69028 KB | Time limit exceeded |
15 | Execution timed out | 2036 ms | 67960 KB | Time limit exceeded |
16 | Execution timed out | 2040 ms | 67780 KB | Time limit exceeded |
17 | Execution timed out | 2044 ms | 77252 KB | Time limit exceeded |
18 | Execution timed out | 2045 ms | 74844 KB | Time limit exceeded |
19 | Execution timed out | 2031 ms | 76176 KB | Time limit exceeded |
20 | Execution timed out | 2040 ms | 73364 KB | Time limit exceeded |
21 | Execution timed out | 2021 ms | 84472 KB | Time limit exceeded |
22 | Execution timed out | 2102 ms | 83772 KB | Time limit exceeded |
23 | Execution timed out | 2060 ms | 82412 KB | Time limit exceeded |
24 | Execution timed out | 2036 ms | 84532 KB | Time limit exceeded |
25 | Execution timed out | 2031 ms | 92456 KB | Time limit exceeded |
26 | Execution timed out | 2050 ms | 157340 KB | Time limit exceeded |
27 | Execution timed out | 2040 ms | 214800 KB | Time limit exceeded |
28 | Execution timed out | 2071 ms | 238164 KB | Time limit exceeded |
29 | Execution timed out | 2041 ms | 244980 KB | Time limit exceeded |
30 | Execution timed out | 2050 ms | 278152 KB | Time limit exceeded |
31 | Execution timed out | 2043 ms | 122336 KB | Time limit exceeded |
32 | Execution timed out | 2037 ms | 299684 KB | Time limit exceeded |