# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42405 | 2018-02-26T17:22:35 Z | Hassoony | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 807472 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,vis[MX][MX],cnt,h; char a[MX][MX]; int dx[]={0,0,-1,1}; int dy[]={1,-1,0,0}; 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); } } 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){ char c='R'; if(a[0][0]=='R')c='F'; cnt=0; dfs(0,0); ans++; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(vis[i][j])a[i][j]=c; } } memset(vis,0,sizeof(vis)); } cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 832 ms | 70392 KB | Output is correct |
2 | Execution timed out | 2024 ms | 70392 KB | Time limit exceeded |
3 | Correct | 520 ms | 70392 KB | Output is correct |
4 | Correct | 131 ms | 72432 KB | Output is correct |
5 | Correct | 1422 ms | 72432 KB | Output is correct |
6 | Execution timed out | 2052 ms | 72432 KB | Time limit exceeded |
7 | Correct | 502 ms | 72432 KB | Output is correct |
8 | Correct | 116 ms | 72432 KB | Output is correct |
9 | Correct | 718 ms | 72432 KB | Output is correct |
10 | Correct | 1841 ms | 72432 KB | Output is correct |
11 | Correct | 100 ms | 72432 KB | Output is correct |
12 | Correct | 552 ms | 72432 KB | Output is correct |
13 | Correct | 1416 ms | 72432 KB | Output is correct |
14 | Correct | 1416 ms | 72432 KB | Output is correct |
15 | Execution timed out | 2053 ms | 72432 KB | Time limit exceeded |
16 | Correct | 839 ms | 72432 KB | Output is correct |
17 | Execution timed out | 2050 ms | 72432 KB | Time limit exceeded |
18 | Correct | 135 ms | 72568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2043 ms | 78692 KB | Time limit exceeded |
2 | Execution timed out | 2057 ms | 78692 KB | Time limit exceeded |
3 | Execution timed out | 2057 ms | 79420 KB | Time limit exceeded |
4 | Execution timed out | 2041 ms | 79420 KB | Time limit exceeded |
5 | Execution timed out | 2043 ms | 79420 KB | Time limit exceeded |
6 | Execution timed out | 2081 ms | 470992 KB | Time limit exceeded |
7 | Execution timed out | 2047 ms | 470992 KB | Time limit exceeded |
8 | Execution timed out | 2051 ms | 470992 KB | Time limit exceeded |
9 | Execution timed out | 2050 ms | 470992 KB | Time limit exceeded |
10 | Execution timed out | 2040 ms | 470992 KB | Time limit exceeded |
11 | Execution timed out | 2050 ms | 470992 KB | Time limit exceeded |
12 | Execution timed out | 2052 ms | 470992 KB | Time limit exceeded |
13 | Execution timed out | 2049 ms | 470992 KB | Time limit exceeded |
14 | Execution timed out | 2032 ms | 470992 KB | Time limit exceeded |
15 | Execution timed out | 2049 ms | 470992 KB | Time limit exceeded |
16 | Execution timed out | 2029 ms | 470992 KB | Time limit exceeded |
17 | Execution timed out | 2031 ms | 470992 KB | Time limit exceeded |
18 | Execution timed out | 2015 ms | 470992 KB | Time limit exceeded |
19 | Execution timed out | 2063 ms | 470992 KB | Time limit exceeded |
20 | Execution timed out | 2059 ms | 470992 KB | Time limit exceeded |
21 | Execution timed out | 2047 ms | 470992 KB | Time limit exceeded |
22 | Execution timed out | 2035 ms | 470992 KB | Time limit exceeded |
23 | Execution timed out | 2025 ms | 470992 KB | Time limit exceeded |
24 | Execution timed out | 2033 ms | 470992 KB | Time limit exceeded |
25 | Execution timed out | 2016 ms | 470992 KB | Time limit exceeded |
26 | Correct | 881 ms | 652520 KB | Output is correct |
27 | Execution timed out | 2082 ms | 807472 KB | Time limit exceeded |
28 | Execution timed out | 2053 ms | 807472 KB | Time limit exceeded |
29 | Execution timed out | 2071 ms | 807472 KB | Time limit exceeded |
30 | Execution timed out | 2057 ms | 807472 KB | Time limit exceeded |
31 | Execution timed out | 2017 ms | 807472 KB | Time limit exceeded |
32 | Execution timed out | 2060 ms | 807472 KB | Time limit exceeded |