# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091837 | 2024-09-22T10:21:35 Z | Jakub_Wozniak | Tracks in the Snow (BOI13_tracks) | C++14 | 2 ms | 904 KB |
#include <bits/stdc++.h> #include <stdio.h> using namespace std; const int maxn = 4009; typedef long long ll; int N , M; string s[maxn]; string SA; int a , b , c; vector <pair<int,int>> R; bool vis[maxn][maxn]; int MAXI = 0; void pr() { R.push_back({-1,0}); R.push_back({1,0}); R.push_back({0,1}); R.push_back({0,-1}); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> M; for(int i = 0 ; i <= M+1 ; i++)SA.push_back( '.'); s[0] = SA; s[N+1] = SA; pr(); for(int i = 1 ; i <= N ;i++) { scanf("%s", SA); s[i] = '.'; s[i] += SA; s[i].push_back('.'); } priority_queue <pair<int,int>> q; pair<int,int> DS; q.push({-1,1*maxn+1}); int i , j; vis[1][1] = 1; while(!q.empty()) { DS = q.top(); c = -DS.first; i = DS.second/maxn; j = DS.second%maxn; q.pop(); MAXI = max(MAXI , c); for(int k = 0 ; k < R.size() ; k++) { a = i+R[k].first; b = j+R[k].second; if(s[a][b] == '.' || vis[a][b])continue; vis[a][b] = 1; if(s[a][b] == s[i][j]){ q.push({-c,a*maxn+b});} else {q.push({-(c+1),a*maxn+b});} } } cout << MAXI << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Incorrect | 0 ms | 604 KB | Output isn't correct |
4 | Runtime error | 1 ms | 904 KB | Execution killed with signal 11 |
5 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
6 | Incorrect | 1 ms | 348 KB | Output isn't correct |
7 | Incorrect | 0 ms | 604 KB | Output isn't correct |
8 | Incorrect | 0 ms | 604 KB | Output isn't correct |
9 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
10 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
13 | Runtime error | 2 ms | 860 KB | Execution killed with signal 11 |
14 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
16 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
17 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
18 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
2 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
3 | Runtime error | 2 ms | 856 KB | Execution killed with signal 11 |
4 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
5 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
6 | Runtime error | 1 ms | 848 KB | Execution killed with signal 11 |
7 | Runtime error | 1 ms | 896 KB | Execution killed with signal 11 |
8 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
9 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
10 | Runtime error | 1 ms | 880 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 904 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
13 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
14 | Runtime error | 2 ms | 864 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
16 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
17 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
18 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
19 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
20 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
21 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
22 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
23 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
24 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
25 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
26 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
27 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
28 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
29 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
30 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
31 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
32 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |