Submission #579234

# Submission time Handle Problem Language Result Execution time Memory
579234 2022-06-18T14:31:45 Z MetalPower IOI Fever (JOI21_fever) C++14
100 / 100
1132 ms 201600 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define fi first
#define se second

const ll MX = 3e5 + 10;
const ll INF = 1e18;

ll N, X[MX], Y[MX]; ll direction[MX];
ll dist[MX * 3]; bool vis[MX * 3], colored[MX * 3];
vector<pii> adj[MX * 3], hori[MX][4], vert[MX][4], incd[MX][4], decd[MX][4];
ll hx[MX], vx[MX], ix[MX], dx[MX];

ll absol(ll x){
	return x >= 0 ? x : -x;
}

void buildEdge(vector<pii>& v, ll st, ll dir){
	if(st == 0){ // increasing
		for(ll i = 1; i < (ll) v.size(); i++){
			// cout << "Edge " << v[i - 1].se * 3 + dir << " to " << v[i].se * 3 + dir << '\n';
			ll w = (v[i].fi - v[i - 1].fi) / (dir == 0 ? 2ll : 1ll);
			adj[v[i - 1].se * 3 + dir].push_back({v[i].se * 3 + dir, w});
		}
	}else{ // decreasing
		for(ll i = (ll) v.size() - 1; i > 0; i--){
			// cout << "Edge " << v[i].se * 3 + dir << " to " << v[i - 1].se * 3 + dir << '\n';
			ll w = (v[i].fi - v[i - 1].fi) / (dir == 0 ? 2ll : 1ll);
			adj[v[i].se * 3 + dir].push_back({v[i - 1].se * 3 + dir, w});
		}
	}
}

ll que(vector<pii>& v, ll dt, ll tp){
	if(tp == 1){
		return (ll)(lower_bound(v.begin(), v.end(), make_pair(dt, (ll) -1)) - v.begin());
	}else if(tp == -1){
		return (ll)(lower_bound(v.begin(), v.end(), make_pair(dt + 1, (ll) -1)) - v.begin()) - 1;
	}
}

ll solve(){
	{ // initialize
		for(ll i = 0; i < MX * 3; i++){
			dist[i] = INF;
			vis[i] = colored[i] = false;
			adj[i].clear();
		}

		for(ll i = 0; i < MX; i++){
			for(ll d = 0; d < 4; d++){
				hori[i][d].clear();
				vert[i][d].clear();
				incd[i][d].clear();
				decd[i][d].clear();
			}
		}

		// cout << "initialize" << '\n';
	}

	{ // Right, Up, Left, Down
		direction[0] = 0;
		for(ll i = 1; i < N; i++){
			if(absol(X[i]) == absol(Y[i])){
				if(X[i] < 0) direction[i] = 0;
				else if(X[i] > 0 && Y[i] < 0) direction[i] = 1;
				else if(X[i] > 0 && Y[i] > 0) direction[i] = 3;
			}else if(absol(X[i]) < absol(Y[i])){
				if(Y[i] < 0) direction[i] = 1;
				else if(Y[i] > 0) direction[i] = 3;
			}else if(absol(X[i]) > absol(Y[i])){
				if(X[i] < 0) direction[i] = 0;
				else if(X[i] > 0) direction[i] = 2;
			}
		}
	}

	{
		vector<ll> hv, vv, iv, dv;

		for(ll i = 0; i < N; i++){
			hv.push_back(Y[i]);
			vv.push_back(X[i]);
			iv.push_back(X[i] - Y[i]);
			dv.push_back(X[i] + Y[i]);
		}

		// cout << "coordinate compress" << '\n';

		sort(hv.begin(), hv.end()); hv.resize(unique(hv.begin(), hv.end()) - hv.begin());
		sort(vv.begin(), vv.end()); vv.resize(unique(vv.begin(), vv.end()) - vv.begin());
		sort(iv.begin(), iv.end()); iv.resize(unique(iv.begin(), iv.end()) - iv.begin());
		sort(dv.begin(), dv.end()); dv.resize(unique(dv.begin(), dv.end()) - dv.begin());

		// cout << "sort" << '\n';

		for(ll i = 0; i < N; i++){
			hx[i] = lower_bound(hv.begin(), hv.end(), Y[i]) - hv.begin();
			vx[i] = lower_bound(vv.begin(), vv.end(), X[i]) - vv.begin();
			ix[i] = lower_bound(iv.begin(), iv.end(), X[i] - Y[i]) - iv.begin();
			dx[i] = lower_bound(dv.begin(), dv.end(), X[i] + Y[i]) - dv.begin();
			hori[hx[i]][direction[i]].push_back({X[i], i}); 
			// cout << "hori " << hx[i] << " " << direction[i] << " node " << i << '\n';
			vert[vx[i]][direction[i]].push_back({Y[i], i});
			// cout << "vert " << vx[i] << " " << direction[i] << " node " << i << '\n';
			incd[ix[i]][direction[i]].push_back({X[i], i});
			// cout << "incd " << ix[i] << " " << direction[i] << " node " << i << '\n';
			decd[dx[i]][direction[i]].push_back({X[i], i});
			// cout << "decd " << dx[i] << " " << direction[i] << " node " << i << '\n';
		}

		// cout << "create groups" << '\n';

		for(ll i = 0; i < N; i++){
			for(ll d = 0; d < 4; d++){
				sort(hori[i][d].begin(), hori[i][d].end());
				sort(vert[i][d].begin(), vert[i][d].end());
				sort(incd[i][d].begin(), incd[i][d].end());
				sort(decd[i][d].begin(), decd[i][d].end());
			}
		}

		for(ll i = 0; i < N; i++){
			// Horizontal / Vertical
			buildEdge(hori[i][0], 1, 0);
			buildEdge(vert[i][1], 1, 0);
			buildEdge(hori[i][2], 0, 0);
			buildEdge(vert[i][3], 0, 0);

			// Increasing Diagonal
			buildEdge(incd[i][0], 1, 2);
			buildEdge(incd[i][1], 1, 1);
			buildEdge(incd[i][2], 0, 2);
			buildEdge(incd[i][3], 0, 1);

			// Decreasing Diagonal
			buildEdge(decd[i][0], 1, 1);
			buildEdge(decd[i][1], 0, 2);
			buildEdge(decd[i][2], 0, 1);
			buildEdge(decd[i][3], 1, 2);
		}

		// cout << "build edge" << '\n';
	}

	{

		priority_queue<pii, vector<pii>, greater<pii>> pq;
		pq.push({0, 0}); pq.push({0, 1}); pq.push({0, 2});

		while(!pq.empty()){
			ll cd = pq.top().fi, pd = pq.top().se; pq.pop();

			if(!vis[pd]){
				if(cd != 0) vis[pd] = true;
				for(pii nxt : adj[pd]){ // nxt.fi = node, nxt.se = weight
					ll nw = dist[pd] + nxt.se;
					if(dist[nxt.fi] > nw){
						dist[nxt.fi] = nw;
						pq.push({dist[nxt.fi], nxt.fi});
					}
				}
			}

			ll nd = pd / 3;
			if(!colored[nd]){

				colored[nd] = true; 

				{ // normal
					ll nxt = -1;
					if(direction[nd] == 0){
						ll idx = que(hori[hx[nd]][2], X[nd] + cd * 2, 1);
						if(0 <= idx && idx < hori[hx[nd]][2].size()) nxt = hori[hx[nd]][2][idx].se;
					}else if(direction[nd] == 1){
						ll idx = que(vert[vx[nd]][3], Y[nd] + cd * 2, 1);
						if(0 <= idx && idx < vert[vx[nd]][3].size()) nxt = vert[vx[nd]][3][idx].se;
					}else if(direction[nd] == 2){
						ll idx = que(hori[hx[nd]][0], X[nd] - cd * 2, -1);
						if(0 <= idx && idx < hori[hx[nd]][0].size()) nxt = hori[hx[nd]][0][idx].se;
					}else if(direction[nd] == 3){
						ll idx = que(vert[vx[nd]][1], Y[nd] - cd * 2, -1);
						if(0 <= idx && idx < vert[vx[nd]][1].size()) nxt = vert[vx[nd]][1][idx].se;
					}
					if(nxt != -1){
						// cout << "Collision " << X[nd] << " " << Y[nd] << " to " << X[nxt] << " " << Y[nxt] << '\n';
						ll ndist = (absol(X[nd] - X[nxt]) + absol(Y[nd] - Y[nxt])) / 2ll;
						if(dist[nxt * 3] > ndist){
							dist[nxt * 3] = ndist;
							pq.push({dist[nxt * 3], nxt * 3});
						}
					}
				}

				// cout << "normal" << '\n';
				// Right, Up, Left, Down

				{ // clockwise
					ll nxt = -1;
					if(direction[nd] == 0){
						ll idx = que(incd[ix[nd]][3], X[nd] + cd, 1);
						if(0 <= idx && idx < incd[ix[nd]][3].size()) nxt = incd[ix[nd]][3][idx].se;
					}else if(direction[nd] == 1){
						ll idx = que(decd[dx[nd]][0], X[nd] - cd, -1);
						if(0 <= idx && idx < decd[dx[nd]][0].size()) nxt = decd[dx[nd]][0][idx].se;
					}else if(direction[nd] == 2){
						ll idx = que(incd[ix[nd]][1], X[nd] - cd, -1);
						if(0 <= idx && idx < incd[ix[nd]][1].size()) nxt = incd[ix[nd]][1][idx].se;
					}else if(direction[nd] == 3){
						ll idx = que(decd[dx[nd]][2], X[nd] + cd, 1);
						if(0 <= idx && idx < decd[dx[nd]][2].size()) nxt = decd[dx[nd]][2][idx].se;
					}
					if(nxt != -1){
						// cout << "Collision " << X[nd] << " " << Y[nd] << " to" << X[nxt] << " " << Y[nxt] << '\n';
						ll ndist = (absol(X[nd] - X[nxt]) + absol(Y[nd] - Y[nxt])) / 2ll;
						if(dist[nxt * 3 + 1] > ndist){
							dist[nxt * 3 + 1] = ndist;
							pq.push({dist[nxt * 3 + 1], nxt * 3 + 1});
						}
					}
				}

				// cout << "clockwise" << '\n';

				{ // counter clockwise
					ll nxt = -1;
					if(direction[nd] == 0){
						ll idx = que(decd[dx[nd]][1], X[nd] + cd, 1);
						if(0 <= idx && idx < decd[dx[nd]][1].size()) nxt = decd[dx[nd]][1][idx].se;
					}else if(direction[nd] == 1){
						ll idx = que(incd[ix[nd]][2], X[nd] + cd, 1);
						if(0 <= idx && idx < incd[ix[nd]][2].size()) nxt = incd[ix[nd]][2][idx].se;
					}else if(direction[nd] == 2){
						ll idx = que(decd[dx[nd]][3], X[nd] - cd, -1);
						if(0 <= idx && idx < decd[dx[nd]][3].size()) nxt = decd[dx[nd]][3][idx].se;
					}else if(direction[nd] == 3){
						ll idx = que(incd[ix[nd]][0], X[nd] - cd, -1);
						if(0 <= idx && idx < incd[ix[nd]][0].size()) nxt = incd[ix[nd]][0][idx].se;
					}
					if(nxt != -1){
						// cout << "Collision " << X[nd] << " " << Y[nd] << " to" << X[nxt] << " " << Y[nxt] << '\n';
						ll ndist = (absol(X[nd] - X[nxt]) + absol(Y[nd] - Y[nxt])) / 2ll;
						if(dist[nxt * 3 + 2] > ndist){
							dist[nxt * 3 + 2] = ndist;
							pq.push({dist[nxt * 3 + 2], nxt * 3 + 2});
						}
					}
				}

				// cout << "counterclockwise" << '\n';
			}
		}

		ll res = 1;
		for(int i = 1; i < N; i++)
			if(min(dist[i * 3], min(dist[i * 3 + 1], dist[i * 3 + 2])) < INF) res++;
		return res;
	}
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> N;
	for(ll i = 0; i < N; i++){
		cin >> X[i] >> Y[i]; X[i] *= 2, Y[i] *= 2;
		if(i > 0) X[i] -= X[0], Y[i] -= Y[0];
	}
	X[0] = Y[0] = 0;

	ll ans = 0;
	for(ll t = 0; t < 4; t++){
		ll curr = solve(); 
		ans = max(ans, curr);
		for(ll i = 0; i < N; i++){ // (x, y) = (y, -x)
			swap(X[i], Y[i]);
			Y[i] = -Y[i];
		}
	}

	cout << ans << '\n';
}

Compilation message

fever.cpp: In function 'long long int solve()':
fever.cpp:178:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  178 |       if(0 <= idx && idx < hori[hx[nd]][2].size()) nxt = hori[hx[nd]][2][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:181:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  181 |       if(0 <= idx && idx < vert[vx[nd]][3].size()) nxt = vert[vx[nd]][3][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:184:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  184 |       if(0 <= idx && idx < hori[hx[nd]][0].size()) nxt = hori[hx[nd]][0][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:187:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  187 |       if(0 <= idx && idx < vert[vx[nd]][1].size()) nxt = vert[vx[nd]][1][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:206:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  206 |       if(0 <= idx && idx < incd[ix[nd]][3].size()) nxt = incd[ix[nd]][3][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:209:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  209 |       if(0 <= idx && idx < decd[dx[nd]][0].size()) nxt = decd[dx[nd]][0][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:212:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  212 |       if(0 <= idx && idx < incd[ix[nd]][1].size()) nxt = incd[ix[nd]][1][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:215:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  215 |       if(0 <= idx && idx < decd[dx[nd]][2].size()) nxt = decd[dx[nd]][2][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:233:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  233 |       if(0 <= idx && idx < decd[dx[nd]][1].size()) nxt = decd[dx[nd]][1][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:236:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  236 |       if(0 <= idx && idx < incd[ix[nd]][2].size()) nxt = incd[ix[nd]][2][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:239:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  239 |       if(0 <= idx && idx < decd[dx[nd]][3].size()) nxt = decd[dx[nd]][3][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:242:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  242 |       if(0 <= idx && idx < incd[ix[nd]][0].size()) nxt = incd[ix[nd]][0][idx].se;
      |                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp: In function 'long long int que(std::vector<std::pair<long long int, long long int> >&, long long int, long long int)':
fever.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
33 Correct 99 ms 142948 KB Output is correct
34 Correct 117 ms 143100 KB Output is correct
35 Correct 96 ms 143016 KB Output is correct
36 Correct 98 ms 142960 KB Output is correct
37 Correct 101 ms 142976 KB Output is correct
38 Correct 98 ms 142924 KB Output is correct
39 Correct 96 ms 143032 KB Output is correct
40 Correct 100 ms 142924 KB Output is correct
41 Correct 99 ms 143116 KB Output is correct
42 Correct 100 ms 143080 KB Output is correct
43 Correct 94 ms 142924 KB Output is correct
44 Correct 95 ms 143044 KB Output is correct
45 Correct 101 ms 142928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 143012 KB Output is correct
2 Correct 100 ms 143004 KB Output is correct
3 Correct 94 ms 143000 KB Output is correct
4 Correct 98 ms 143180 KB Output is correct
5 Correct 101 ms 143068 KB Output is correct
6 Correct 95 ms 143072 KB Output is correct
7 Correct 95 ms 143180 KB Output is correct
8 Correct 103 ms 143080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
33 Correct 99 ms 142948 KB Output is correct
34 Correct 117 ms 143100 KB Output is correct
35 Correct 96 ms 143016 KB Output is correct
36 Correct 98 ms 142960 KB Output is correct
37 Correct 101 ms 142976 KB Output is correct
38 Correct 98 ms 142924 KB Output is correct
39 Correct 96 ms 143032 KB Output is correct
40 Correct 100 ms 142924 KB Output is correct
41 Correct 99 ms 143116 KB Output is correct
42 Correct 100 ms 143080 KB Output is correct
43 Correct 94 ms 142924 KB Output is correct
44 Correct 95 ms 143044 KB Output is correct
45 Correct 101 ms 142928 KB Output is correct
46 Correct 99 ms 143012 KB Output is correct
47 Correct 100 ms 143004 KB Output is correct
48 Correct 94 ms 143000 KB Output is correct
49 Correct 98 ms 143180 KB Output is correct
50 Correct 101 ms 143068 KB Output is correct
51 Correct 95 ms 143072 KB Output is correct
52 Correct 95 ms 143180 KB Output is correct
53 Correct 103 ms 143080 KB Output is correct
54 Correct 110 ms 142976 KB Output is correct
55 Correct 97 ms 143052 KB Output is correct
56 Correct 97 ms 142992 KB Output is correct
57 Correct 109 ms 142972 KB Output is correct
58 Correct 99 ms 143052 KB Output is correct
59 Correct 94 ms 143052 KB Output is correct
60 Correct 97 ms 143004 KB Output is correct
61 Correct 94 ms 142992 KB Output is correct
62 Correct 100 ms 143000 KB Output is correct
63 Correct 104 ms 142952 KB Output is correct
64 Correct 96 ms 142992 KB Output is correct
65 Correct 101 ms 143012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
33 Correct 99 ms 142948 KB Output is correct
34 Correct 117 ms 143100 KB Output is correct
35 Correct 96 ms 143016 KB Output is correct
36 Correct 98 ms 142960 KB Output is correct
37 Correct 101 ms 142976 KB Output is correct
38 Correct 98 ms 142924 KB Output is correct
39 Correct 96 ms 143032 KB Output is correct
40 Correct 100 ms 142924 KB Output is correct
41 Correct 99 ms 143116 KB Output is correct
42 Correct 100 ms 143080 KB Output is correct
43 Correct 94 ms 142924 KB Output is correct
44 Correct 95 ms 143044 KB Output is correct
45 Correct 101 ms 142928 KB Output is correct
46 Correct 99 ms 143012 KB Output is correct
47 Correct 100 ms 143004 KB Output is correct
48 Correct 94 ms 143000 KB Output is correct
49 Correct 98 ms 143180 KB Output is correct
50 Correct 101 ms 143068 KB Output is correct
51 Correct 95 ms 143072 KB Output is correct
52 Correct 95 ms 143180 KB Output is correct
53 Correct 103 ms 143080 KB Output is correct
54 Correct 110 ms 142976 KB Output is correct
55 Correct 97 ms 143052 KB Output is correct
56 Correct 97 ms 142992 KB Output is correct
57 Correct 109 ms 142972 KB Output is correct
58 Correct 99 ms 143052 KB Output is correct
59 Correct 94 ms 143052 KB Output is correct
60 Correct 97 ms 143004 KB Output is correct
61 Correct 94 ms 142992 KB Output is correct
62 Correct 100 ms 143000 KB Output is correct
63 Correct 104 ms 142952 KB Output is correct
64 Correct 96 ms 142992 KB Output is correct
65 Correct 101 ms 143012 KB Output is correct
66 Correct 118 ms 144372 KB Output is correct
67 Correct 132 ms 144468 KB Output is correct
68 Correct 119 ms 144136 KB Output is correct
69 Correct 123 ms 144232 KB Output is correct
70 Correct 118 ms 144344 KB Output is correct
71 Correct 111 ms 144332 KB Output is correct
72 Correct 114 ms 144236 KB Output is correct
73 Correct 116 ms 144280 KB Output is correct
74 Correct 114 ms 144552 KB Output is correct
75 Correct 109 ms 144620 KB Output is correct
76 Correct 110 ms 144204 KB Output is correct
77 Correct 115 ms 144456 KB Output is correct
78 Correct 132 ms 144116 KB Output is correct
79 Correct 109 ms 144204 KB Output is correct
80 Correct 110 ms 144012 KB Output is correct
81 Correct 125 ms 144076 KB Output is correct
82 Correct 122 ms 144688 KB Output is correct
83 Correct 107 ms 144536 KB Output is correct
84 Correct 101 ms 144504 KB Output is correct
85 Correct 116 ms 144596 KB Output is correct
86 Correct 121 ms 144524 KB Output is correct
87 Correct 100 ms 144580 KB Output is correct
88 Correct 105 ms 144680 KB Output is correct
89 Correct 123 ms 143876 KB Output is correct
90 Correct 123 ms 143820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
33 Correct 99 ms 142948 KB Output is correct
34 Correct 117 ms 143100 KB Output is correct
35 Correct 96 ms 143016 KB Output is correct
36 Correct 98 ms 142960 KB Output is correct
37 Correct 101 ms 142976 KB Output is correct
38 Correct 98 ms 142924 KB Output is correct
39 Correct 96 ms 143032 KB Output is correct
40 Correct 100 ms 142924 KB Output is correct
41 Correct 99 ms 143116 KB Output is correct
42 Correct 100 ms 143080 KB Output is correct
43 Correct 94 ms 142924 KB Output is correct
44 Correct 95 ms 143044 KB Output is correct
45 Correct 101 ms 142928 KB Output is correct
46 Correct 99 ms 143012 KB Output is correct
47 Correct 100 ms 143004 KB Output is correct
48 Correct 94 ms 143000 KB Output is correct
49 Correct 98 ms 143180 KB Output is correct
50 Correct 101 ms 143068 KB Output is correct
51 Correct 95 ms 143072 KB Output is correct
52 Correct 95 ms 143180 KB Output is correct
53 Correct 103 ms 143080 KB Output is correct
54 Correct 110 ms 142976 KB Output is correct
55 Correct 97 ms 143052 KB Output is correct
56 Correct 97 ms 142992 KB Output is correct
57 Correct 109 ms 142972 KB Output is correct
58 Correct 99 ms 143052 KB Output is correct
59 Correct 94 ms 143052 KB Output is correct
60 Correct 97 ms 143004 KB Output is correct
61 Correct 94 ms 142992 KB Output is correct
62 Correct 100 ms 143000 KB Output is correct
63 Correct 104 ms 142952 KB Output is correct
64 Correct 96 ms 142992 KB Output is correct
65 Correct 101 ms 143012 KB Output is correct
66 Correct 755 ms 172984 KB Output is correct
67 Correct 966 ms 188132 KB Output is correct
68 Correct 933 ms 189384 KB Output is correct
69 Correct 835 ms 196956 KB Output is correct
70 Correct 918 ms 185516 KB Output is correct
71 Correct 898 ms 182412 KB Output is correct
72 Correct 908 ms 181800 KB Output is correct
73 Correct 927 ms 194300 KB Output is correct
74 Correct 902 ms 181980 KB Output is correct
75 Correct 940 ms 180436 KB Output is correct
76 Correct 835 ms 180176 KB Output is correct
77 Correct 897 ms 179076 KB Output is correct
78 Correct 834 ms 170616 KB Output is correct
79 Correct 842 ms 170776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 142904 KB Output is correct
2 Correct 102 ms 142924 KB Output is correct
3 Correct 96 ms 142924 KB Output is correct
4 Correct 96 ms 142960 KB Output is correct
5 Correct 94 ms 142912 KB Output is correct
6 Correct 101 ms 143008 KB Output is correct
7 Correct 105 ms 143016 KB Output is correct
8 Correct 98 ms 142920 KB Output is correct
9 Correct 93 ms 143100 KB Output is correct
10 Correct 95 ms 142984 KB Output is correct
11 Correct 148 ms 143160 KB Output is correct
12 Correct 98 ms 143024 KB Output is correct
13 Correct 96 ms 143020 KB Output is correct
14 Correct 93 ms 143040 KB Output is correct
15 Correct 101 ms 143028 KB Output is correct
16 Correct 108 ms 143032 KB Output is correct
17 Correct 101 ms 143032 KB Output is correct
18 Correct 92 ms 143044 KB Output is correct
19 Correct 93 ms 142976 KB Output is correct
20 Correct 96 ms 143032 KB Output is correct
21 Correct 102 ms 143064 KB Output is correct
22 Correct 117 ms 142924 KB Output is correct
23 Correct 93 ms 143032 KB Output is correct
24 Correct 95 ms 142924 KB Output is correct
25 Correct 97 ms 142996 KB Output is correct
26 Correct 100 ms 142924 KB Output is correct
27 Correct 98 ms 143028 KB Output is correct
28 Correct 93 ms 143052 KB Output is correct
29 Correct 98 ms 142956 KB Output is correct
30 Correct 101 ms 142948 KB Output is correct
31 Correct 101 ms 142924 KB Output is correct
32 Correct 93 ms 143032 KB Output is correct
33 Correct 99 ms 142948 KB Output is correct
34 Correct 117 ms 143100 KB Output is correct
35 Correct 96 ms 143016 KB Output is correct
36 Correct 98 ms 142960 KB Output is correct
37 Correct 101 ms 142976 KB Output is correct
38 Correct 98 ms 142924 KB Output is correct
39 Correct 96 ms 143032 KB Output is correct
40 Correct 100 ms 142924 KB Output is correct
41 Correct 99 ms 143116 KB Output is correct
42 Correct 100 ms 143080 KB Output is correct
43 Correct 94 ms 142924 KB Output is correct
44 Correct 95 ms 143044 KB Output is correct
45 Correct 101 ms 142928 KB Output is correct
46 Correct 99 ms 143012 KB Output is correct
47 Correct 100 ms 143004 KB Output is correct
48 Correct 94 ms 143000 KB Output is correct
49 Correct 98 ms 143180 KB Output is correct
50 Correct 101 ms 143068 KB Output is correct
51 Correct 95 ms 143072 KB Output is correct
52 Correct 95 ms 143180 KB Output is correct
53 Correct 103 ms 143080 KB Output is correct
54 Correct 110 ms 142976 KB Output is correct
55 Correct 97 ms 143052 KB Output is correct
56 Correct 97 ms 142992 KB Output is correct
57 Correct 109 ms 142972 KB Output is correct
58 Correct 99 ms 143052 KB Output is correct
59 Correct 94 ms 143052 KB Output is correct
60 Correct 97 ms 143004 KB Output is correct
61 Correct 94 ms 142992 KB Output is correct
62 Correct 100 ms 143000 KB Output is correct
63 Correct 104 ms 142952 KB Output is correct
64 Correct 96 ms 142992 KB Output is correct
65 Correct 101 ms 143012 KB Output is correct
66 Correct 118 ms 144372 KB Output is correct
67 Correct 132 ms 144468 KB Output is correct
68 Correct 119 ms 144136 KB Output is correct
69 Correct 123 ms 144232 KB Output is correct
70 Correct 118 ms 144344 KB Output is correct
71 Correct 111 ms 144332 KB Output is correct
72 Correct 114 ms 144236 KB Output is correct
73 Correct 116 ms 144280 KB Output is correct
74 Correct 114 ms 144552 KB Output is correct
75 Correct 109 ms 144620 KB Output is correct
76 Correct 110 ms 144204 KB Output is correct
77 Correct 115 ms 144456 KB Output is correct
78 Correct 132 ms 144116 KB Output is correct
79 Correct 109 ms 144204 KB Output is correct
80 Correct 110 ms 144012 KB Output is correct
81 Correct 125 ms 144076 KB Output is correct
82 Correct 122 ms 144688 KB Output is correct
83 Correct 107 ms 144536 KB Output is correct
84 Correct 101 ms 144504 KB Output is correct
85 Correct 116 ms 144596 KB Output is correct
86 Correct 121 ms 144524 KB Output is correct
87 Correct 100 ms 144580 KB Output is correct
88 Correct 105 ms 144680 KB Output is correct
89 Correct 123 ms 143876 KB Output is correct
90 Correct 123 ms 143820 KB Output is correct
91 Correct 755 ms 172984 KB Output is correct
92 Correct 966 ms 188132 KB Output is correct
93 Correct 933 ms 189384 KB Output is correct
94 Correct 835 ms 196956 KB Output is correct
95 Correct 918 ms 185516 KB Output is correct
96 Correct 898 ms 182412 KB Output is correct
97 Correct 908 ms 181800 KB Output is correct
98 Correct 927 ms 194300 KB Output is correct
99 Correct 902 ms 181980 KB Output is correct
100 Correct 940 ms 180436 KB Output is correct
101 Correct 835 ms 180176 KB Output is correct
102 Correct 897 ms 179076 KB Output is correct
103 Correct 834 ms 170616 KB Output is correct
104 Correct 842 ms 170776 KB Output is correct
105 Correct 638 ms 179880 KB Output is correct
106 Correct 801 ms 188200 KB Output is correct
107 Correct 1105 ms 174688 KB Output is correct
108 Correct 965 ms 187020 KB Output is correct
109 Correct 856 ms 186856 KB Output is correct
110 Correct 980 ms 187980 KB Output is correct
111 Correct 944 ms 191260 KB Output is correct
112 Correct 915 ms 181164 KB Output is correct
113 Correct 904 ms 179368 KB Output is correct
114 Correct 1132 ms 189356 KB Output is correct
115 Correct 943 ms 192964 KB Output is correct
116 Correct 916 ms 181080 KB Output is correct
117 Correct 944 ms 179652 KB Output is correct
118 Correct 1022 ms 179640 KB Output is correct
119 Correct 880 ms 178520 KB Output is correct
120 Correct 904 ms 178204 KB Output is correct
121 Correct 928 ms 178040 KB Output is correct
122 Correct 934 ms 176472 KB Output is correct
123 Correct 875 ms 197376 KB Output is correct
124 Correct 870 ms 195856 KB Output is correct
125 Correct 362 ms 194020 KB Output is correct
126 Correct 388 ms 198008 KB Output is correct
127 Correct 374 ms 189972 KB Output is correct
128 Correct 410 ms 201600 KB Output is correct
129 Correct 403 ms 192948 KB Output is correct