# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42409 | 2018-02-26T18:14:39 Z | Hassoony | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 280540 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()){ 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)continue; if(a[nx][ny]==a[x][y])q[node].push({nx,ny}); else q[node^1].push({nx,ny}); } } node^=1; ans++; } cout<<ans-1<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 4472 KB | Output isn't correct |
2 | Incorrect | 2 ms | 4472 KB | Output isn't correct |
3 | Incorrect | 2 ms | 4472 KB | Output isn't correct |
4 | Correct | 16 ms | 5080 KB | Output is correct |
5 | Incorrect | 11 ms | 5080 KB | Output isn't correct |
6 | Incorrect | 1 ms | 5080 KB | Output isn't correct |
7 | Incorrect | 2 ms | 5080 KB | Output isn't correct |
8 | Correct | 2 ms | 5080 KB | Output is correct |
9 | Incorrect | 3 ms | 5080 KB | Output isn't correct |
10 | Incorrect | 10 ms | 5080 KB | Output isn't correct |
11 | Correct | 5 ms | 5080 KB | Output is correct |
12 | Incorrect | 11 ms | 5080 KB | Output isn't correct |
13 | Incorrect | 9 ms | 5080 KB | Output isn't correct |
14 | Incorrect | 9 ms | 5080 KB | Output isn't correct |
15 | Incorrect | 26 ms | 7324 KB | Output isn't correct |
16 | Incorrect | 28 ms | 7324 KB | Output isn't correct |
17 | Incorrect | 25 ms | 7324 KB | Output isn't correct |
18 | Correct | 16 ms | 7324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 32384 KB | Output isn't correct |
2 | Incorrect | 159 ms | 32384 KB | Output isn't correct |
3 | Incorrect | 1624 ms | 163508 KB | Output isn't correct |
4 | Incorrect | 365 ms | 163508 KB | Output isn't correct |
5 | Incorrect | 1049 ms | 204092 KB | Output isn't correct |
6 | Correct | 1918 ms | 204092 KB | Output is correct |
7 | Incorrect | 32 ms | 204092 KB | Output isn't correct |
8 | Incorrect | 30 ms | 204092 KB | Output isn't correct |
9 | Incorrect | 6 ms | 204092 KB | Output isn't correct |
10 | Incorrect | 3 ms | 204092 KB | Output isn't correct |
11 | Incorrect | 29 ms | 204092 KB | Output isn't correct |
12 | Incorrect | 4 ms | 204092 KB | Output isn't correct |
13 | Incorrect | 149 ms | 204092 KB | Output isn't correct |
14 | Incorrect | 85 ms | 204092 KB | Output isn't correct |
15 | Incorrect | 84 ms | 204092 KB | Output isn't correct |
16 | Incorrect | 60 ms | 204092 KB | Output isn't correct |
17 | Incorrect | 456 ms | 204092 KB | Output isn't correct |
18 | Incorrect | 331 ms | 204092 KB | Output isn't correct |
19 | Incorrect | 325 ms | 204092 KB | Output isn't correct |
20 | Incorrect | 333 ms | 204092 KB | Output isn't correct |
21 | Incorrect | 949 ms | 204092 KB | Output isn't correct |
22 | Incorrect | 1083 ms | 256836 KB | Output isn't correct |
23 | Incorrect | 871 ms | 256836 KB | Output isn't correct |
24 | Incorrect | 1202 ms | 256836 KB | Output isn't correct |
25 | Incorrect | 1423 ms | 280540 KB | Output isn't correct |
26 | Incorrect | 919 ms | 280540 KB | Output isn't correct |
27 | Correct | 1289 ms | 280540 KB | Output is correct |
28 | Correct | 1961 ms | 280540 KB | Output is correct |
29 | Execution timed out | 2041 ms | 280540 KB | Time limit exceeded |
30 | Correct | 1704 ms | 280540 KB | Output is correct |
31 | Incorrect | 1446 ms | 280540 KB | Output isn't correct |
32 | Incorrect | 1292 ms | 280540 KB | Output isn't correct |