# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928988 | 2024-02-17T11:53:25 Z | Lyrically | Tracks in the Snow (BOI13_tracks) | C++17 | 398 ms | 157520 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define pb push_back #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) void file(string s){ freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } int n,m; char c[4005][4005]; int dis[4005][4005]; int dx[4]={-1,0,1,0}; int dy[4]={0,-1,0,1}; signed main(){ cin>>n>>m; rep1(i,n)scanf("%s",c[i]+1); memset(dis,-1,sizeof(dis)); dis[1][1]=0; queue<array<int,2>> q;q.push({1,1}); while(!q.empty()){ array<int,2> x=q.front();q.pop(); rep(i,4){ int tx=x[0]+dx[i],ty=x[1]+dy[i]; if(tx<1||ty<1||tx>n||ty>m)continue; if(dis[tx][ty]!=-1)continue; dis[tx][ty]=dis[x[0]][x[1]]+(c[x[0]][x[1]]!=c[tx][ty]); q.push({tx,ty}); } } cout<<dis[n][m]<<"\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 129944 KB | Output isn't correct |
2 | Incorrect | 15 ms | 127832 KB | Output isn't correct |
3 | Incorrect | 16 ms | 127576 KB | Output isn't correct |
4 | Incorrect | 19 ms | 129876 KB | Output isn't correct |
5 | Incorrect | 16 ms | 127836 KB | Output isn't correct |
6 | Incorrect | 15 ms | 127704 KB | Output isn't correct |
7 | Incorrect | 15 ms | 127760 KB | Output isn't correct |
8 | Incorrect | 15 ms | 127828 KB | Output isn't correct |
9 | Incorrect | 16 ms | 127836 KB | Output isn't correct |
10 | Incorrect | 17 ms | 127836 KB | Output isn't correct |
11 | Incorrect | 16 ms | 127812 KB | Output isn't correct |
12 | Incorrect | 18 ms | 127944 KB | Output isn't correct |
13 | Incorrect | 17 ms | 127836 KB | Output isn't correct |
14 | Incorrect | 20 ms | 127804 KB | Output isn't correct |
15 | Incorrect | 20 ms | 130128 KB | Output isn't correct |
16 | Incorrect | 20 ms | 129876 KB | Output isn't correct |
17 | Incorrect | 20 ms | 130096 KB | Output isn't correct |
18 | Incorrect | 19 ms | 129884 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 140892 KB | Output isn't correct |
2 | Incorrect | 42 ms | 133456 KB | Output isn't correct |
3 | Incorrect | 379 ms | 157264 KB | Output isn't correct |
4 | Incorrect | 89 ms | 137564 KB | Output isn't correct |
5 | Incorrect | 196 ms | 146852 KB | Output isn't correct |
6 | Incorrect | 380 ms | 157332 KB | Output isn't correct |
7 | Incorrect | 18 ms | 141660 KB | Output isn't correct |
8 | Incorrect | 19 ms | 140892 KB | Output isn't correct |
9 | Incorrect | 17 ms | 127836 KB | Output isn't correct |
10 | Incorrect | 16 ms | 127836 KB | Output isn't correct |
11 | Incorrect | 19 ms | 141404 KB | Output isn't correct |
12 | Incorrect | 15 ms | 127684 KB | Output isn't correct |
13 | Incorrect | 43 ms | 133468 KB | Output isn't correct |
14 | Incorrect | 30 ms | 130644 KB | Output isn't correct |
15 | Incorrect | 33 ms | 132688 KB | Output isn't correct |
16 | Incorrect | 25 ms | 128348 KB | Output isn't correct |
17 | Incorrect | 89 ms | 137820 KB | Output isn't correct |
18 | Incorrect | 100 ms | 137816 KB | Output isn't correct |
19 | Incorrect | 84 ms | 137664 KB | Output isn't correct |
20 | Incorrect | 78 ms | 137532 KB | Output isn't correct |
21 | Incorrect | 202 ms | 149268 KB | Output isn't correct |
22 | Incorrect | 192 ms | 146784 KB | Output isn't correct |
23 | Incorrect | 194 ms | 143632 KB | Output isn't correct |
24 | Incorrect | 198 ms | 149036 KB | Output isn't correct |
25 | Incorrect | 367 ms | 157472 KB | Output isn't correct |
26 | Incorrect | 266 ms | 152160 KB | Output isn't correct |
27 | Incorrect | 398 ms | 157520 KB | Output isn't correct |
28 | Incorrect | 356 ms | 157344 KB | Output isn't correct |
29 | Incorrect | 351 ms | 157520 KB | Output isn't correct |
30 | Incorrect | 337 ms | 156496 KB | Output isn't correct |
31 | Incorrect | 229 ms | 150168 KB | Output isn't correct |
32 | Incorrect | 396 ms | 157352 KB | Output isn't correct |