Submission #1053645

# Submission time Handle Problem Language Result Execution time Memory
1053645 2024-08-11T14:56:51 Z vjudge1 Tracks in the Snow (BOI13_tracks) C++17
3.85417 / 100
1476 ms 63620 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pld pair<ld, ld>
#define pb push_back
#define fi first
#define se second
#define debug(x) cout << #x << " => " << x << endl
#define all(x) x.begin(),x.end()

bool vis[4010][4010];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n,m;cin>>n>>m;
	string s[n];
	for(int i=0;i<n;i++) cin>>s[i];

	priority_queue<pair<int,pii>> pq;
	pq.push({0,{0,0}});
	int ans=0;
	while(!pq.empty())
	{
		int x=pq.top().se.fi,y=pq.top().se.se,v=pq.top().fi;
		pq.pop();
		if(vis[x][y]) continue;
		ans=max(ans,v);
		vis[x][y]=1;
		if(x+1<n && !vis[x+1][y]) pq.push({-(v+(s[x][y]!=s[x+1][y])),{x+1,y}});
		if(y+1<n && !vis[x][y+1]) pq.push({-(v+(s[x][y]!=s[x][y+1])),{x,y+1}});
	}
	cout<<ans+1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 3240 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 0 ms 604 KB Output isn't correct
4 Incorrect 16 ms 2912 KB Output isn't correct
5 Incorrect 6 ms 1788 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 604 KB Output isn't correct
8 Correct 1 ms 604 KB Output is correct
9 Incorrect 1 ms 896 KB Output isn't correct
10 Incorrect 8 ms 1500 KB Output isn't correct
11 Incorrect 3 ms 1372 KB Output isn't correct
12 Incorrect 11 ms 1884 KB Output isn't correct
13 Incorrect 7 ms 1760 KB Output isn't correct
14 Incorrect 8 ms 1920 KB Output isn't correct
15 Incorrect 20 ms 3308 KB Output isn't correct
16 Incorrect 28 ms 3360 KB Output isn't correct
17 Incorrect 19 ms 3148 KB Output isn't correct
18 Incorrect 16 ms 2908 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 931 ms 22508 KB Output isn't correct
2 Incorrect 128 ms 10188 KB Output isn't correct
3 Incorrect 1476 ms 63620 KB Output isn't correct
4 Incorrect 274 ms 16940 KB Output isn't correct
5 Incorrect 360 ms 30932 KB Output isn't correct
6 Incorrect 1196 ms 55908 KB Output isn't correct
7 Incorrect 1272 ms 29424 KB Output isn't correct
8 Incorrect 919 ms 22300 KB Output isn't correct
9 Incorrect 0 ms 604 KB Output isn't correct
10 Incorrect 0 ms 348 KB Output isn't correct
11 Runtime error 21 ms 32540 KB Execution killed with signal 11
12 Incorrect 2 ms 856 KB Output isn't correct
13 Incorrect 120 ms 10152 KB Output isn't correct
14 Incorrect 65 ms 6732 KB Output isn't correct
15 Incorrect 42 ms 6236 KB Output isn't correct
16 Incorrect 13 ms 3608 KB Output isn't correct
17 Incorrect 324 ms 23604 KB Output isn't correct
18 Incorrect 174 ms 16468 KB Output isn't correct
19 Incorrect 258 ms 17100 KB Output isn't correct
20 Incorrect 266 ms 17448 KB Output isn't correct
21 Incorrect 608 ms 38588 KB Output isn't correct
22 Incorrect 355 ms 30888 KB Output isn't correct
23 Incorrect 575 ms 33316 KB Output isn't correct
24 Incorrect 693 ms 37892 KB Output isn't correct
25 Incorrect 1404 ms 62116 KB Output isn't correct
26 Correct 493 ms 39748 KB Output is correct
27 Incorrect 868 ms 51172 KB Output isn't correct
28 Incorrect 1184 ms 57280 KB Output isn't correct
29 Incorrect 1230 ms 57284 KB Output isn't correct
30 Incorrect 1145 ms 55440 KB Output isn't correct
31 Incorrect 1026 ms 48312 KB Output isn't correct
32 Incorrect 1022 ms 51072 KB Output isn't correct