# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26484 | 2017-07-01T10:07:50 Z | samir_droubi | Tracks in the Snow (BOI13_tracks) | C++14 | 0 ms | 17684 KB |
#include <bits/stdc++.h> using namespace std; const short int mxn=4005; char g[mxn][mxn]; short int n,m; short int dx[]={0,0,1,-1}; short 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; short 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(short 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); short int cnt=n*m; for(short int i=0;i<n;++i)scanf("%s",&g[i]); for(short int i=0;i<n;++i) { for(short int j=0;j<m;++j) if(g[i][j]=='.') --cnt; } v.push_back({0,0}); short int ans=0; while(c!=cnt) { for(short int i=0;i<v.size();++i) { short int x=v[i].first; short 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 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
2 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
3 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
4 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
5 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
6 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
7 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
8 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
9 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
10 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
11 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
12 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
13 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
14 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
15 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
16 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
17 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
18 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
2 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
3 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
4 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
5 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
6 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
7 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
8 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
9 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
10 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
11 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
12 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
13 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
14 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
15 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
16 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
17 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
18 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
19 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
20 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
21 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
22 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
23 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
24 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
25 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
26 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
27 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
28 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
29 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
30 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
31 | Incorrect | 0 ms | 17684 KB | Output isn't correct |
32 | Incorrect | 0 ms | 17684 KB | Output isn't correct |