# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26485 | 2017-07-01T10:10:57 Z | samir_droubi | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 997344 KB |
#include <bits/stdc++.h> using namespace std; const int mxn=4005; char g[mxn][mxn]; int n,m; int dx[]={0,0,1,-1}; int dy[]={1,-1,0,0}; bool check(short int x,short int y) { return x>=0&&x<n&&y>=0&&y<m; } char ty; int c=0; vector<pair<short int,short int> >v; vector<pair<short int,short int> >vv; void dfs(short int x,short int y) { ++c; g[x][y]='.'; for(int i=0;i<4;++i) { short int xx=x+dx[i]; short int yy=y+dy[i]; if(!check(xx,yy))continue; if(g[xx][yy]!=ty) { vv.push_back({xx,yy}); continue; } dfs(xx,yy); } } int main() { scanf("%d%d",&n,&m); int cnt=n*m; for(int i=0;i<n;++i)scanf("%s",&g[i]); for(int i=0;i<n;++i) { for(int j=0;j<m;++j) if(g[i][j]=='.') --cnt; } v.push_back({1,1}); int ans=0; while(c!=cnt) { for(int i=0;i<v.size();++i) { int x=v[i].first; int y=v[i].second; if(g[x][y]=='.')continue; ty=g[x][y]; dfs(x,y); } v=vv; vv.clear(); ++ans; } printf("%d\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
2 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
3 | Correct | 0 ms | 17684 KB | Output is correct |
4 | Correct | 6 ms | 20660 KB | Output is correct |
5 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
6 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
7 | Correct | 0 ms | 17684 KB | Output is correct |
8 | Correct | 0 ms | 17824 KB | Output is correct |
9 | Correct | 0 ms | 17684 KB | Output is correct |
10 | Correct | 0 ms | 17684 KB | Output is correct |
11 | Incorrect | 3 ms | 18400 KB | Output isn't correct |
12 | Correct | 3 ms | 17956 KB | Output is correct |
13 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
14 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
15 | Correct | 9 ms | 18092 KB | Output is correct |
16 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
17 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
18 | Correct | 13 ms | 20664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
2 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
3 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
4 | Correct | 59 ms | 17884 KB | Output is correct |
5 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
6 | Correct | 973 ms | 288436 KB | Output is correct |
7 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
8 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
9 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
10 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
11 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
12 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
13 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
14 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
15 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
16 | Correct | 23 ms | 17824 KB | Output is correct |
17 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
18 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
19 | Correct | 53 ms | 17880 KB | Output is correct |
20 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
21 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
22 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
23 | Correct | 263 ms | 18116 KB | Output is correct |
24 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
25 | Execution timed out | 2000 ms | 17684 KB | Execution timed out |
26 | Correct | 709 ms | 997344 KB | Output is correct |
27 | Correct | 939 ms | 429768 KB | Output is correct |
28 | Correct | 1066 ms | 288432 KB | Output is correct |
29 | Correct | 1043 ms | 278608 KB | Output is correct |
30 | Correct | 989 ms | 373780 KB | Output is correct |
31 | Correct | 633 ms | 22540 KB | Output is correct |
32 | Incorrect | 829 ms | 576428 KB | Output isn't correct |