# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42407 | 2018-02-26T17:28:55 Z | Hassoony | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 1003268 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,cnt,h; bool vis[MX][MX]; char a[MX][MX],c; int dx[]={0,0,-1,1}; int dy[]={1,-1,0,0}; vector<pair<int,int> >nodes; void dfs(int x,int y){ if(vis[x][y])return; vis[x][y]=1; cnt++; 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||a[nx][ny]!=a[x][y])continue; dfs(nx,ny); } a[x][y]=c; } int main(){ scanf("%d%d",&n,&m); for(int i=0;i<n;i++)scanf("%s",&a[i]); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(a[i][j]!='.')h++; } } int ans=0; while(cnt!=h){ c='R'; if(a[0][0]=='R')c='F'; cnt=0; dfs(0,0); ans++; memset(vis,0,sizeof(vis)); } cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 285 ms | 25080 KB | Output is correct |
2 | Correct | 149 ms | 25080 KB | Output is correct |
3 | Correct | 42 ms | 25080 KB | Output is correct |
4 | Correct | 49 ms | 27764 KB | Output is correct |
5 | Correct | 154 ms | 27764 KB | Output is correct |
6 | Correct | 151 ms | 27764 KB | Output is correct |
7 | Correct | 46 ms | 27764 KB | Output is correct |
8 | Correct | 19 ms | 27764 KB | Output is correct |
9 | Correct | 57 ms | 27764 KB | Output is correct |
10 | Correct | 187 ms | 27764 KB | Output is correct |
11 | Correct | 25 ms | 27764 KB | Output is correct |
12 | Correct | 104 ms | 27764 KB | Output is correct |
13 | Correct | 162 ms | 27764 KB | Output is correct |
14 | Correct | 152 ms | 27764 KB | Output is correct |
15 | Correct | 716 ms | 27764 KB | Output is correct |
16 | Correct | 296 ms | 27764 KB | Output is correct |
17 | Correct | 632 ms | 27764 KB | Output is correct |
18 | Correct | 50 ms | 27888 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2031 ms | 32008 KB | Time limit exceeded |
2 | Execution timed out | 2049 ms | 37192 KB | Time limit exceeded |
3 | Execution timed out | 2055 ms | 37192 KB | Time limit exceeded |
4 | Execution timed out | 2050 ms | 37192 KB | Time limit exceeded |
5 | Execution timed out | 2045 ms | 37192 KB | Time limit exceeded |
6 | Execution timed out | 2070 ms | 690756 KB | Time limit exceeded |
7 | Execution timed out | 2035 ms | 690756 KB | Time limit exceeded |
8 | Execution timed out | 2062 ms | 690756 KB | Time limit exceeded |
9 | Correct | 371 ms | 690756 KB | Output is correct |
10 | Execution timed out | 2033 ms | 690756 KB | Time limit exceeded |
11 | Execution timed out | 2033 ms | 690756 KB | Time limit exceeded |
12 | Execution timed out | 2050 ms | 690756 KB | Time limit exceeded |
13 | Execution timed out | 2057 ms | 690756 KB | Time limit exceeded |
14 | Execution timed out | 2062 ms | 690756 KB | Time limit exceeded |
15 | Execution timed out | 2059 ms | 690756 KB | Time limit exceeded |
16 | Execution timed out | 2052 ms | 690756 KB | Time limit exceeded |
17 | Execution timed out | 2067 ms | 690756 KB | Time limit exceeded |
18 | Execution timed out | 2056 ms | 690756 KB | Time limit exceeded |
19 | Execution timed out | 2055 ms | 690756 KB | Time limit exceeded |
20 | Execution timed out | 2025 ms | 690756 KB | Time limit exceeded |
21 | Execution timed out | 2047 ms | 690756 KB | Time limit exceeded |
22 | Execution timed out | 2063 ms | 690756 KB | Time limit exceeded |
23 | Execution timed out | 2068 ms | 690756 KB | Time limit exceeded |
24 | Execution timed out | 2056 ms | 690756 KB | Time limit exceeded |
25 | Execution timed out | 2050 ms | 690756 KB | Time limit exceeded |
26 | Correct | 927 ms | 797308 KB | Output is correct |
27 | Execution timed out | 2122 ms | 1003268 KB | Time limit exceeded |
28 | Execution timed out | 2079 ms | 1003268 KB | Time limit exceeded |
29 | Execution timed out | 2090 ms | 1003268 KB | Time limit exceeded |
30 | Execution timed out | 2096 ms | 1003268 KB | Time limit exceeded |
31 | Execution timed out | 2045 ms | 1003268 KB | Time limit exceeded |
32 | Execution timed out | 2055 ms | 1003268 KB | Time limit exceeded |