# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101561 | 2019-03-19T04:26:44 Z | dantoh000 | Tracks in the Snow (BOI13_tracks) | C++14 | 2000 ms | 31864 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; int main(){ int h,w; scanf("%d%d",&h,&w); char grid[h][w]; int nonempty = 0; for (int i = 0; i < h; i++){ for (int j = 0; j < w; j++){ scanf(" %c",&grid[i][j]); if (grid[i][j] != '.') nonempty++; } } int num = 0; bool vis[h][w]; int ans = 0; while (num != nonempty){ char a = grid[0][0]; char b = a ^ 'F' ^ 'R'; memset(vis,0,sizeof(vis)); queue<ii> q; q.push(ii(0,0)); vis[0][0] = 1; grid[0][0] = b; num = 1; while(q.size()){ ii cur = q.front(); q.pop(); int x = cur.first, y = cur.second; for (int k = 0; k < 4; k++){ int nx = x + dx[k], ny = y + dy[k]; if (nx >= 0 && nx < h && ny >= 0 && ny < w){ if (grid[nx][ny] == a && !vis[nx][ny]){ grid[nx][ny] = b; vis[nx][ny] = 1; num++; q.push(ii(nx,ny)); } } } } ans++; } printf("%d",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 174 ms | 888 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 26 ms | 640 KB | Output is correct |
5 | Correct | 46 ms | 484 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 256 KB | Output is correct |
9 | Correct | 6 ms | 256 KB | Output is correct |
10 | Correct | 81 ms | 512 KB | Output is correct |
11 | Correct | 7 ms | 384 KB | Output is correct |
12 | Correct | 56 ms | 512 KB | Output is correct |
13 | Correct | 49 ms | 512 KB | Output is correct |
14 | Correct | 55 ms | 632 KB | Output is correct |
15 | Correct | 444 ms | 896 KB | Output is correct |
16 | Correct | 163 ms | 888 KB | Output is correct |
17 | Correct | 344 ms | 888 KB | Output is correct |
18 | Correct | 32 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1016 ms | 460 KB | Output is correct |
2 | Execution timed out | 2041 ms | 3320 KB | Time limit exceeded |
3 | Execution timed out | 2029 ms | 31732 KB | Time limit exceeded |
4 | Execution timed out | 2033 ms | 7800 KB | Time limit exceeded |
5 | Execution timed out | 2029 ms | 18004 KB | Time limit exceeded |
6 | Execution timed out | 2053 ms | 31864 KB | Time limit exceeded |
7 | Correct | 802 ms | 476 KB | Output is correct |
8 | Correct | 1112 ms | 508 KB | Output is correct |
9 | Correct | 138 ms | 384 KB | Output is correct |
10 | Correct | 324 ms | 416 KB | Output is correct |
11 | Correct | 254 ms | 384 KB | Output is correct |
12 | Correct | 1494 ms | 384 KB | Output is correct |
13 | Execution timed out | 2036 ms | 3532 KB | Time limit exceeded |
14 | Execution timed out | 2013 ms | 2168 KB | Time limit exceeded |
15 | Execution timed out | 2049 ms | 2296 KB | Time limit exceeded |
16 | Execution timed out | 2050 ms | 1528 KB | Time limit exceeded |
17 | Execution timed out | 2058 ms | 8312 KB | Time limit exceeded |
18 | Execution timed out | 2021 ms | 8184 KB | Time limit exceeded |
19 | Execution timed out | 2056 ms | 7928 KB | Time limit exceeded |
20 | Execution timed out | 2067 ms | 7080 KB | Time limit exceeded |
21 | Execution timed out | 2028 ms | 18552 KB | Time limit exceeded |
22 | Execution timed out | 2021 ms | 17960 KB | Time limit exceeded |
23 | Execution timed out | 2025 ms | 15524 KB | Time limit exceeded |
24 | Execution timed out | 2045 ms | 18268 KB | Time limit exceeded |
25 | Execution timed out | 2097 ms | 31836 KB | Time limit exceeded |
26 | Correct | 1402 ms | 24568 KB | Output is correct |
27 | Execution timed out | 2047 ms | 31816 KB | Time limit exceeded |
28 | Execution timed out | 2050 ms | 31836 KB | Time limit exceeded |
29 | Execution timed out | 2053 ms | 31864 KB | Time limit exceeded |
30 | Execution timed out | 2041 ms | 31096 KB | Time limit exceeded |
31 | Execution timed out | 2095 ms | 20344 KB | Time limit exceeded |
32 | Execution timed out | 2044 ms | 31864 KB | Time limit exceeded |