# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
876604 | 2023-11-22T05:24:38 Z | vjudge1 | Tracks in the Snow (BOI13_tracks) | C++17 | 561 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(){ 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; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 561 ms | 1048576 KB | Execution killed with signal 9 |
2 | Runtime error | 367 ms | 1048576 KB | Execution killed with signal 9 |
3 | Runtime error | 319 ms | 1048576 KB | Execution killed with signal 9 |
4 | Runtime error | 309 ms | 1048576 KB | Execution killed with signal 9 |
5 | Runtime error | 296 ms | 1048576 KB | Execution killed with signal 9 |
6 | Runtime error | 312 ms | 1048576 KB | Execution killed with signal 9 |
7 | Runtime error | 301 ms | 1048576 KB | Execution killed with signal 9 |
8 | Runtime error | 337 ms | 1048576 KB | Execution killed with signal 9 |
9 | Runtime error | 303 ms | 1048576 KB | Execution killed with signal 9 |
10 | Runtime error | 329 ms | 1048576 KB | Execution killed with signal 9 |
11 | Runtime error | 298 ms | 1048576 KB | Execution killed with signal 9 |
12 | Runtime error | 298 ms | 1048576 KB | Execution killed with signal 9 |
13 | Runtime error | 295 ms | 1048576 KB | Execution killed with signal 9 |
14 | Runtime error | 300 ms | 1048576 KB | Execution killed with signal 9 |
15 | Runtime error | 300 ms | 1048576 KB | Execution killed with signal 9 |
16 | Runtime error | 306 ms | 1048576 KB | Execution killed with signal 9 |
17 | Runtime error | 296 ms | 1048576 KB | Execution killed with signal 9 |
18 | Runtime error | 300 ms | 1048576 KB | Execution killed with signal 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 307 ms | 1048576 KB | Execution killed with signal 9 |
2 | Runtime error | 314 ms | 1048576 KB | Execution killed with signal 9 |
3 | Runtime error | 310 ms | 1048576 KB | Execution killed with signal 9 |
4 | Runtime error | 297 ms | 1048576 KB | Execution killed with signal 9 |
5 | Runtime error | 296 ms | 1048576 KB | Execution killed with signal 9 |
6 | Runtime error | 300 ms | 1048576 KB | Execution killed with signal 9 |
7 | Runtime error | 352 ms | 1048576 KB | Execution killed with signal 9 |
8 | Runtime error | 309 ms | 1048576 KB | Execution killed with signal 9 |
9 | Runtime error | 294 ms | 1048576 KB | Execution killed with signal 9 |
10 | Runtime error | 299 ms | 1048576 KB | Execution killed with signal 9 |
11 | Runtime error | 307 ms | 1048576 KB | Execution killed with signal 9 |
12 | Runtime error | 317 ms | 1048576 KB | Execution killed with signal 9 |
13 | Runtime error | 297 ms | 1048576 KB | Execution killed with signal 9 |
14 | Runtime error | 301 ms | 1048576 KB | Execution killed with signal 9 |
15 | Runtime error | 298 ms | 1048576 KB | Execution killed with signal 9 |
16 | Runtime error | 302 ms | 1048576 KB | Execution killed with signal 9 |
17 | Runtime error | 297 ms | 1048576 KB | Execution killed with signal 9 |
18 | Runtime error | 300 ms | 1048576 KB | Execution killed with signal 9 |
19 | Runtime error | 301 ms | 1048576 KB | Execution killed with signal 9 |
20 | Runtime error | 304 ms | 1048576 KB | Execution killed with signal 9 |
21 | Runtime error | 301 ms | 1048576 KB | Execution killed with signal 9 |
22 | Runtime error | 321 ms | 1048576 KB | Execution killed with signal 9 |
23 | Runtime error | 297 ms | 1048576 KB | Execution killed with signal 9 |
24 | Runtime error | 303 ms | 1048576 KB | Execution killed with signal 9 |
25 | Runtime error | 298 ms | 1048576 KB | Execution killed with signal 9 |
26 | Runtime error | 305 ms | 1048576 KB | Execution killed with signal 9 |
27 | Runtime error | 323 ms | 1048576 KB | Execution killed with signal 9 |
28 | Runtime error | 304 ms | 1048576 KB | Execution killed with signal 9 |
29 | Runtime error | 299 ms | 1048576 KB | Execution killed with signal 9 |
30 | Runtime error | 303 ms | 1048576 KB | Execution killed with signal 9 |
31 | Runtime error | 317 ms | 1048576 KB | Execution killed with signal 9 |
32 | Runtime error | 309 ms | 1048576 KB | Execution killed with signal 9 |