# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
876606 | 2023-11-22T05:28:13 Z | vjudge1 | Tracks in the Snow (BOI13_tracks) | C++17 | 350 ms | 1048576 KB |
#include <iostream> #include <vector> #include <queue> #define endl '\n' #define pb push_back using namespace std; int n, h, w; const int MAXN = 2e7; string mat[MAXN]; queue<int> q[2]; vector<int> adj[MAXN]; bool tp[MAXN], used[MAXN]; int main(){ ios::sync_with_stdio(0);cin.tie(0); cin >> h >> w; for(int i=0; i<h; i++) cin >> mat[i]; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ if(mat[i][j] == '.') continue; int v = (i*w) + j; int u = (i+1)*w + j; if(i < (h-1) && mat[i+1][j] != '.'){ adj[v].pb(u); adj[u].pb(v); } u = (i*w) + j + 1; if(j < (w-1) && mat[i][j+1] != '.'){ adj[v].pb(u); adj[u].pb(v); } tp[v] = (mat[i][j] == 'F')? 0 : 1; } } int p, cnt=0; if(mat[0][0] == 'F'){ q[0].push(0); p = 0; } else{ q[1].push(0); p = 1; } used[0] = 1; while(!q[0].empty() || !q[1].empty()){ while(!q[p].empty()){ int v = q[p].front(); q[p].pop(); for(int u : adj[v]){ if(used[u]) continue; q[tp[u]].push(u); used[u] = 1; } } p ^= 1; cnt++; } cout << cnt << endl; return 0; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 350 ms | 1048576 KB | Execution killed with signal 9 |
2 | Runtime error | 295 ms | 1048576 KB | Execution killed with signal 9 |
3 | Runtime error | 275 ms | 1048576 KB | Execution killed with signal 9 |
4 | Runtime error | 257 ms | 1048576 KB | Execution killed with signal 9 |
5 | Runtime error | 211 ms | 1048576 KB | Execution killed with signal 9 |
6 | Runtime error | 218 ms | 1048576 KB | Execution killed with signal 9 |
7 | Runtime error | 217 ms | 1048576 KB | Execution killed with signal 9 |
8 | Runtime error | 207 ms | 1048576 KB | Execution killed with signal 9 |
9 | Runtime error | 206 ms | 1048576 KB | Execution killed with signal 9 |
10 | Runtime error | 211 ms | 1048576 KB | Execution killed with signal 9 |
11 | Runtime error | 211 ms | 1048576 KB | Execution killed with signal 9 |
12 | Runtime error | 212 ms | 1048576 KB | Execution killed with signal 9 |
13 | Runtime error | 207 ms | 1048576 KB | Execution killed with signal 9 |
14 | Runtime error | 197 ms | 1048576 KB | Execution killed with signal 9 |
15 | Runtime error | 199 ms | 1048576 KB | Execution killed with signal 9 |
16 | Runtime error | 205 ms | 1048576 KB | Execution killed with signal 9 |
17 | Runtime error | 200 ms | 1048576 KB | Execution killed with signal 9 |
18 | Runtime error | 213 ms | 1048576 KB | Execution killed with signal 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 198 ms | 1048576 KB | Execution killed with signal 9 |
2 | Runtime error | 198 ms | 1048576 KB | Execution killed with signal 9 |
3 | Runtime error | 206 ms | 1048576 KB | Execution killed with signal 9 |
4 | Runtime error | 199 ms | 1048576 KB | Execution killed with signal 9 |
5 | Runtime error | 196 ms | 1048576 KB | Execution killed with signal 9 |
6 | Runtime error | 216 ms | 1048576 KB | Execution killed with signal 9 |
7 | Runtime error | 194 ms | 1048576 KB | Execution killed with signal 9 |
8 | Runtime error | 198 ms | 1048576 KB | Execution killed with signal 9 |
9 | Runtime error | 192 ms | 1048576 KB | Execution killed with signal 9 |
10 | Runtime error | 193 ms | 1048576 KB | Execution killed with signal 9 |
11 | Runtime error | 198 ms | 1048576 KB | Execution killed with signal 9 |
12 | Runtime error | 190 ms | 1048576 KB | Execution killed with signal 9 |
13 | Runtime error | 195 ms | 1048576 KB | Execution killed with signal 9 |
14 | Runtime error | 193 ms | 1048576 KB | Execution killed with signal 9 |
15 | Runtime error | 197 ms | 1048576 KB | Execution killed with signal 9 |
16 | Runtime error | 198 ms | 1048576 KB | Execution killed with signal 9 |
17 | Runtime error | 192 ms | 1048576 KB | Execution killed with signal 9 |
18 | Runtime error | 202 ms | 1048576 KB | Execution killed with signal 9 |
19 | Runtime error | 194 ms | 1048576 KB | Execution killed with signal 9 |
20 | Runtime error | 192 ms | 1048576 KB | Execution killed with signal 9 |
21 | Runtime error | 192 ms | 1048576 KB | Execution killed with signal 9 |
22 | Runtime error | 200 ms | 1048576 KB | Execution killed with signal 9 |
23 | Runtime error | 194 ms | 1048576 KB | Execution killed with signal 9 |
24 | Runtime error | 194 ms | 1048576 KB | Execution killed with signal 9 |
25 | Runtime error | 200 ms | 1048576 KB | Execution killed with signal 9 |
26 | Runtime error | 196 ms | 1048576 KB | Execution killed with signal 9 |
27 | Runtime error | 194 ms | 1048576 KB | Execution killed with signal 9 |
28 | Runtime error | 197 ms | 1048576 KB | Execution killed with signal 9 |
29 | Runtime error | 205 ms | 1048576 KB | Execution killed with signal 9 |
30 | Runtime error | 192 ms | 1048576 KB | Execution killed with signal 9 |
31 | Runtime error | 204 ms | 1048576 KB | Execution killed with signal 9 |
32 | Runtime error | 203 ms | 1048576 KB | Execution killed with signal 9 |