# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42410 | 2018-02-26T18:16:49 Z | Hassoony | Tracks in the Snow (BOI13_tracks) | C++14 | 1381 ms | 107028 KB |
#include<bits/stdc++.h> #include<unordered_map> #define F first #define S second using namespace std; typedef long long ll; typedef long double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=4002; int n,m,ans; bool vis[MX][MX]; char a[MX][MX],c; int dx[]={0,0,-1,1}; int dy[]={1,-1,0,0}; int main(){ scanf("%d%d",&n,&m); for(int i=0;i<n;i++)scanf("%s",&a[i]); queue<pair<int,int> >q[2]; int node=0; q[node].push({0,0}); while(!q[node].empty()){ ans++; while(!q[node].empty()){ int x=q[node].front().first,y=q[node].front().second;q[node].pop(); if(vis[x][y])continue; vis[x][y]=1; for(int i=0;i<4;i++){ int nx=dx[i]+x,ny=dy[i]+y; if(nx>=n||ny>=m||nx<0||ny<0||vis[nx][ny])continue; if(a[nx][ny]==a[x][y])q[node].push({nx,ny}); else q[node^1].push({nx,ny}); } } node^=1; } cout<<ans-1<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 4344 KB | Output isn't correct |
2 | Incorrect | 2 ms | 4344 KB | Output isn't correct |
3 | Incorrect | 2 ms | 4344 KB | Output isn't correct |
4 | Incorrect | 15 ms | 4592 KB | Output isn't correct |
5 | Incorrect | 9 ms | 4592 KB | Output isn't correct |
6 | Incorrect | 1 ms | 4592 KB | Output isn't correct |
7 | Incorrect | 2 ms | 4592 KB | Output isn't correct |
8 | Incorrect | 2 ms | 4592 KB | Output isn't correct |
9 | Incorrect | 3 ms | 4592 KB | Output isn't correct |
10 | Incorrect | 7 ms | 4592 KB | Output isn't correct |
11 | Incorrect | 6 ms | 4592 KB | Output isn't correct |
12 | Incorrect | 11 ms | 4592 KB | Output isn't correct |
13 | Incorrect | 8 ms | 4592 KB | Output isn't correct |
14 | Incorrect | 10 ms | 4592 KB | Output isn't correct |
15 | Incorrect | 22 ms | 5356 KB | Output isn't correct |
16 | Incorrect | 23 ms | 5356 KB | Output isn't correct |
17 | Incorrect | 24 ms | 5356 KB | Output isn't correct |
18 | Incorrect | 15 ms | 5356 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 30560 KB | Output isn't correct |
2 | Incorrect | 124 ms | 30560 KB | Output isn't correct |
3 | Incorrect | 1192 ms | 76048 KB | Output isn't correct |
4 | Incorrect | 274 ms | 76048 KB | Output isn't correct |
5 | Incorrect | 796 ms | 98688 KB | Output isn't correct |
6 | Incorrect | 1364 ms | 98688 KB | Output isn't correct |
7 | Incorrect | 30 ms | 98688 KB | Output isn't correct |
8 | Incorrect | 29 ms | 98688 KB | Output isn't correct |
9 | Incorrect | 4 ms | 98688 KB | Output isn't correct |
10 | Incorrect | 3 ms | 98688 KB | Output isn't correct |
11 | Incorrect | 40 ms | 98688 KB | Output isn't correct |
12 | Incorrect | 3 ms | 98688 KB | Output isn't correct |
13 | Incorrect | 120 ms | 98688 KB | Output isn't correct |
14 | Incorrect | 68 ms | 98688 KB | Output isn't correct |
15 | Incorrect | 57 ms | 98688 KB | Output isn't correct |
16 | Incorrect | 47 ms | 98688 KB | Output isn't correct |
17 | Incorrect | 336 ms | 98688 KB | Output isn't correct |
18 | Incorrect | 206 ms | 98688 KB | Output isn't correct |
19 | Incorrect | 264 ms | 98688 KB | Output isn't correct |
20 | Incorrect | 243 ms | 98688 KB | Output isn't correct |
21 | Incorrect | 721 ms | 98688 KB | Output isn't correct |
22 | Incorrect | 788 ms | 98688 KB | Output isn't correct |
23 | Incorrect | 690 ms | 98688 KB | Output isn't correct |
24 | Incorrect | 870 ms | 98688 KB | Output isn't correct |
25 | Incorrect | 842 ms | 107028 KB | Output isn't correct |
26 | Incorrect | 677 ms | 107028 KB | Output isn't correct |
27 | Incorrect | 932 ms | 107028 KB | Output isn't correct |
28 | Incorrect | 1381 ms | 107028 KB | Output isn't correct |
29 | Incorrect | 1378 ms | 107028 KB | Output isn't correct |
30 | Incorrect | 1147 ms | 107028 KB | Output isn't correct |
31 | Incorrect | 1065 ms | 107028 KB | Output isn't correct |
32 | Incorrect | 886 ms | 107028 KB | Output isn't correct |