Submission #386287

# Submission time Handle Problem Language Result Execution time Memory
386287 2021-04-06T09:38:52 Z model_code IOI Fever (JOI21_fever) C++17
100 / 100
1436 ms 128400 KB
#include <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

// 入力など
long long N;
long long X[1 << 17], Y[1 << 17];
long long dir[1 << 19];

// 座標圧縮
vector<long long> GX, GY, GPLUS, GMINS;
vector<tuple<long long, long long, int>> PX[100009][4];
vector<tuple<long long, long long, int>> PY[100009][4];
vector<tuple<long long, long long, int>> PPLUS[100009][4];
vector<tuple<long long, long long, int>> PMINS[100009][4];
long long PLUS[1 << 17], MINS[1 << 17];

// シミュレーション
priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> Q;
vector<pair<long long, int>> G[1 << 19];
long long dist[1 << 19], final_dst[1 << 19];
bool used[1 << 19];
bool used2[1 << 19];

// その他
int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

void init() {
	GX.clear(); GY.clear(); GPLUS.clear(); GMINS.clear();
	for (int i = 0; i < 100009; i++) {
		PLUS[i] = 0; MINS[i] = 0;
		for (int j = 0; j < 4; j++) {
			PX[i][j].clear(); PY[i][j].clear();
			PPLUS[i][j].clear(); PMINS[i][j].clear();
		}
	}
	for (int i = 0; i < (1 << 19); i++) {
		G[i].clear(); dist[i] = 0;
		used[i] = false; used2[i] = false;
	}
}

long long dst(int p1, int p2) {
	return abs(GX[X[p1]] - GX[X[p2]]) + abs(GY[Y[p1]] - GY[Y[p2]]);
}

void henhari(vector<tuple<long long, long long, int>> v, vector<int> t1, vector<int> t2) {
	int pre1 = -1, pre2 = -1;
	for (int i = 0; i < v.size(); i++) {
		int idx = get<2>(v[i]);
		if (t1[dir[idx]] == 1) {
			if (pre1 != -1) G[pre1 * 3 + t2[dir[idx]]].push_back(make_pair(idx * 3 + t2[dir[idx]], dst(pre1, idx) / 2));
			pre1 = idx;
		}
		if (t1[dir[idx]] == 2) {
			if (pre2 != -1) G[idx * 3 + t2[dir[idx]]].push_back(make_pair(pre2 * 3 + t2[dir[idx]], dst(pre2, idx) / 2));
			pre2 = idx;
		}
	}
}

void adds(long long tm, int pos, int ty) {
	long long ux = GX[X[pos]];
	long long uy = GY[Y[pos]];
	long long vx = GX[X[pos]] + tm * dx[dir[pos]] * 2LL;
	long long vy = GY[Y[pos]] + tm * dy[dir[pos]] * 2LL;

	if (ty == -1) {
		int nex = -1;
		if (dir[pos] == 0) {
			int pos1 = lower_bound(PMINS[MINS[pos]][3].begin(), PMINS[MINS[pos]][3].end(), make_tuple(ux + tm, 0, 0)) - PMINS[MINS[pos]][3].begin();
			if (pos1 < PMINS[MINS[pos]][3].size()) nex = get<2>(PMINS[MINS[pos]][3][pos1]);
		}
		if (dir[pos] == 2) {
			int pos1 = lower_bound(PPLUS[PLUS[pos]][0].begin(), PPLUS[PLUS[pos]][0].end(), make_tuple(ux - tm, (1 << 30), (1 << 30))) - PPLUS[PLUS[pos]][0].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PPLUS[PLUS[pos]][0][pos1]);
		}
		if (dir[pos] == 4) {
			int pos1 = lower_bound(PMINS[MINS[pos]][1].begin(), PMINS[MINS[pos]][1].end(), make_tuple(ux - tm, (1 << 30), (1 << 30))) - PMINS[MINS[pos]][1].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PMINS[MINS[pos]][1][pos1]);
		}
		if (dir[pos] == 6) {
			int pos1 = lower_bound(PPLUS[PLUS[pos]][2].begin(), PPLUS[PLUS[pos]][2].end(), make_tuple(ux + tm, 0, 0)) - PPLUS[PLUS[pos]][2].begin();
			if (pos1 < PPLUS[PLUS[pos]][2].size()) nex = get<2>(PPLUS[PLUS[pos]][2][pos1]);
		}
		if (nex != -1) {
			long long dsts = dst(pos, nex) / 2LL;
			if (dist[nex * 3 + 2] > dsts) {
				dist[nex * 3 + 2] = dsts;
				Q.push(make_pair(dist[nex * 3 + 2], nex * 3 + 2));
			}
		}
	}
	if (ty == 0) {
		int nex = -1;
		if (dir[pos] == 0) {
			int pos1 = lower_bound(PY[Y[pos]][2].begin(), PY[Y[pos]][2].end(), make_tuple(vx, vy, 0)) - PY[Y[pos]][2].begin();
			if (pos1 < PY[Y[pos]][2].size()) nex = get<2>(PY[Y[pos]][2][pos1]);
		}
		if (dir[pos] == 2) {
			int pos1 = lower_bound(PX[X[pos]][3].begin(), PX[X[pos]][3].end(), make_tuple(vx, vy, 0)) - PX[X[pos]][3].begin();
			if (pos1 < PX[X[pos]][3].size()) nex = get<2>(PX[X[pos]][3][pos1]);
		}
		if (dir[pos] == 4) {
			int pos1 = lower_bound(PY[Y[pos]][0].begin(), PY[Y[pos]][0].end(), make_tuple(vx, vy, (1 << 30))) - PY[Y[pos]][0].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PY[Y[pos]][0][pos1]);
		}
		if (dir[pos] == 6) {
			int pos1 = lower_bound(PX[X[pos]][1].begin(), PX[X[pos]][1].end(), make_tuple(vx, vy, (1 << 30))) - PX[X[pos]][1].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PX[X[pos]][1][pos1]);
		}
		if (nex != -1) {
			long long dsts = dst(pos, nex) / 2LL;
			if (dist[nex * 3 + 1] > dsts) {
				dist[nex * 3 + 1] = dsts;
				Q.push(make_pair(dist[nex * 3 + 1], nex * 3 + 1));
			}
		}
	}
	if (ty == 1) {
		int nex = -1;
		if (dir[pos] == 0) {
			int pos1 = lower_bound(PPLUS[PLUS[pos]][1].begin(), PPLUS[PLUS[pos]][1].end(), make_tuple(ux + tm, 0, 0)) - PPLUS[PLUS[pos]][1].begin();
			if (pos1 < PPLUS[PLUS[pos]][1].size()) nex = get<2>(PPLUS[PLUS[pos]][1][pos1]);
		}
		if (dir[pos] == 2) {
			int pos1 = lower_bound(PMINS[MINS[pos]][2].begin(), PMINS[MINS[pos]][2].end(), make_tuple(ux + tm, 0, 0)) - PMINS[MINS[pos]][2].begin();
			if (pos1 < PMINS[MINS[pos]][2].size()) nex = get<2>(PMINS[MINS[pos]][2][pos1]);
		}
		if (dir[pos] == 4) {
			int pos1 = lower_bound(PPLUS[PLUS[pos]][3].begin(), PPLUS[PLUS[pos]][3].end(), make_tuple(ux - tm, (1 << 30), (1 << 30))) - PPLUS[PLUS[pos]][3].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PPLUS[PLUS[pos]][3][pos1]);
		}
		if (dir[pos] == 6) {
			int pos1 = lower_bound(PMINS[MINS[pos]][0].begin(), PMINS[MINS[pos]][0].end(), make_tuple(ux - tm, (1 << 30), (1 << 30))) - PMINS[MINS[pos]][0].begin(); pos1--;
			if (pos1 >= 0) nex = get<2>(PMINS[MINS[pos]][0][pos1]);
		}
		if (nex != -1) {
			long long dsts = dst(pos, nex) / 2LL;
			if (dist[nex * 3 + 0] > dsts) {
				dist[nex * 3 + 0] = dsts;
				Q.push(make_pair(dist[nex * 3 + 0], nex * 3 + 0));
			}
		}
	}
}

long long solve() {
	init();

	// Step A. 向きを決める
	dir[0] = 0;
	for (int i = 1; i < N; i++) {
		if (X[i] > X[0] && abs(X[i] - X[0]) > abs(Y[i] - Y[0])) dir[i] = 4;
		else if (X[i] < X[0] && abs(X[i] - X[0]) >= abs(Y[i] - Y[0])) dir[i] = 0;
		else if (Y[i] > Y[0]) dir[i] = 6;
		else dir[i] = 2;
	}

	// Step B. 座標圧縮する
	for (int i = 0; i < N; i++) PLUS[i] = X[i] + Y[i];
	for (int i = 0; i < N; i++) MINS[i] = X[i] - Y[i];
	for (int i = 0; i < N; i++) GX.push_back(X[i]);
	for (int i = 0; i < N; i++) GY.push_back(Y[i]);
	for (int i = 0; i < N; i++) GPLUS.push_back(X[i] + Y[i]);
	for (int i = 0; i < N; i++) GMINS.push_back(X[i] - Y[i]);
	sort(GX.begin(), GX.end()); GX.erase(unique(GX.begin(), GX.end()), GX.end());
	sort(GY.begin(), GY.end()); GY.erase(unique(GY.begin(), GY.end()), GY.end());
	sort(GPLUS.begin(), GPLUS.end()); GPLUS.erase(unique(GPLUS.begin(), GPLUS.end()), GPLUS.end());
	sort(GMINS.begin(), GMINS.end()); GMINS.erase(unique(GMINS.begin(), GMINS.end()), GMINS.end());
	for (int i = 0; i < N; i++) X[i] = lower_bound(GX.begin(), GX.end(), X[i]) - GX.begin();
	for (int i = 0; i < N; i++) Y[i] = lower_bound(GY.begin(), GY.end(), Y[i]) - GY.begin();
	for (int i = 0; i < N; i++) PLUS[i] = lower_bound(GPLUS.begin(), GPLUS.end(), PLUS[i]) - GPLUS.begin();
	for (int i = 0; i < N; i++) MINS[i] = lower_bound(GMINS.begin(), GMINS.end(), MINS[i]) - GMINS.begin();

	// Step C. 辺を貼る前準備
	for (int i = 0; i < N; i++) PX[X[i]][dir[i] / 2].push_back(make_tuple(GX[X[i]], GY[Y[i]], i));
	for (int i = 0; i < N; i++) PY[Y[i]][dir[i] / 2].push_back(make_tuple(GX[X[i]], GY[Y[i]], i));
	for (int i = 0; i < N; i++) PPLUS[PLUS[i]][dir[i] / 2].push_back(make_tuple(GX[X[i]], GY[Y[i]], i));
	for (int i = 0; i < N; i++) PMINS[MINS[i]][dir[i] / 2].push_back(make_tuple(GX[X[i]], GY[Y[i]], i));
	for (int t = 0; t < 4; t++) {
		for (int i = 0; i < GX.size(); i++) sort(PX[i][t].begin(), PX[i][t].end());
		for (int i = 0; i < GY.size(); i++) sort(PY[i][t].begin(), PY[i][t].end());
		for (int i = 0; i < GPLUS.size(); i++) sort(PPLUS[i][t].begin(), PPLUS[i][t].end());
		for (int i = 0; i < GMINS.size(); i++) sort(PMINS[i][t].begin(), PMINS[i][t].end());
	}

	// Step D. 辺を貼る
	for (int t = 0; t < 4; t++) {
		for (int i = 0; i < GX.size(); i++) henhari(PX[i][t], vector<int>{0, 0, 2, 0, 0, 0, 1, 0}, vector<int>{1, 1, 1, 1, 1, 1, 1, 1});
		for (int i = 0; i < GY.size(); i++) henhari(PY[i][t], vector<int>{2, 0, 0, 0, 1, 0, 0, 0}, vector<int>{1, 1, 1, 1, 1, 1, 1, 1});
		for (int i = 0; i < GPLUS.size(); i++) henhari(PPLUS[i][t], vector<int>{2, 0, 1, 0, 1, 0, 2, 0}, vector<int>{2, 1, 0, 1, 2, 1, 0, 1});
		for (int i = 0; i < GMINS.size(); i++) henhari(PMINS[i][t], vector<int>{2, 0, 2, 0, 1, 0, 1, 0}, vector<int>{0, 1, 2, 1, 0, 1, 2, 1});
	}

	// Step E. ダイクストラ法
	for (int i = 0; i < N * 3; i++) dist[i] = (1LL << 60);
	Q.push(make_pair(0, 0));
	Q.push(make_pair(0, 1));
	Q.push(make_pair(0, 2));
	while (!Q.empty()) {
		long long tm = Q.top().first;
		long long pos = Q.top().second; Q.pop();
		if (used2[pos] == false) {
			if (tm != 0) used2[pos] = true;
			for (int i = 0; i < G[pos].size(); i++) {
				int to = G[pos][i].first;
				long long cost = G[pos][i].second;
				if (dist[to] > dist[pos] + cost) {
					dist[to] = dist[pos] + cost;
					Q.push(make_pair(dist[to], to));
				}
			}
		}
		if (used[pos / 3] == false) {
			used[pos / 3] = true;
			adds(tm, pos / 3, -1);
			adds(tm, pos / 3, 0);
			adds(tm, pos / 3, 1);
		}
	}

	for (int i = 0; i < N; i++) X[i] = GX[X[i]];
	for (int i = 0; i < N; i++) Y[i] = GY[Y[i]];
	for (int i = 0; i < N; i++) final_dst[i] = (1LL << 60);
	for (int i = 0; i < N * 3; i++) final_dst[i / 3] = min(final_dst[i / 3], dist[i]);

	int cnt = 0;
	final_dst[0] = 0;
	for (int i = 0; i < N; i++) {
		if (final_dst[i] != (1LL << 60)) cnt += 1;
	}
	return cnt;
}

int main() {
	// Step #1. 入力(0-indexed)
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld%lld", &X[i], &Y[i]);
		X[i] *= 2; Y[i] *= 2;
	}

	// Step #2. 全探索
	long long Answer = 0;
	for (int t = 0; t < 4; t++) {
		long long ret = solve();
		Answer = max(Answer, ret);
		for (int i = 0; i < N; i++) {
			long long sx = X[i], sy = Y[i];
			X[i] = -sy;
			Y[i] = sx;
		}
	}

	// Step #3. 出力
	cout << Answer << endl;
	return 0;
}

Compilation message

fever.cpp:9: warning: ignoring #pragma warning  [-Wunknown-pragmas]
    9 | #pragma warning (disable: 4996)
      | 
fever.cpp: In function 'void henhari(std::vector<std::tuple<long long int, long long int, int> >, std::vector<int>, std::vector<int>)':
fever.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |  for (int i = 0; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
fever.cpp: In function 'void adds(long long int, int, int)':
fever.cpp:79:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |    if (pos1 < PMINS[MINS[pos]][3].size()) nex = get<2>(PMINS[MINS[pos]][3][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:91:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |    if (pos1 < PPLUS[PLUS[pos]][2].size()) nex = get<2>(PPLUS[PLUS[pos]][2][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:105:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |    if (pos1 < PY[Y[pos]][2].size()) nex = get<2>(PY[Y[pos]][2][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~
fever.cpp:109:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |    if (pos1 < PX[X[pos]][3].size()) nex = get<2>(PX[X[pos]][3][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~
fever.cpp:131:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  131 |    if (pos1 < PPLUS[PLUS[pos]][1].size()) nex = get<2>(PPLUS[PLUS[pos]][1][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:135:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  135 |    if (pos1 < PMINS[MINS[pos]][2].size()) nex = get<2>(PMINS[MINS[pos]][2][pos1]);
      |        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fever.cpp:71:12: warning: unused variable 'uy' [-Wunused-variable]
   71 |  long long uy = GY[Y[pos]];
      |            ^~
fever.cpp: In function 'long long int solve()':
fever.cpp:189:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  189 |   for (int i = 0; i < GX.size(); i++) sort(PX[i][t].begin(), PX[i][t].end());
      |                   ~~^~~~~~~~~~~
fever.cpp:190:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  190 |   for (int i = 0; i < GY.size(); i++) sort(PY[i][t].begin(), PY[i][t].end());
      |                   ~~^~~~~~~~~~~
fever.cpp:191:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  191 |   for (int i = 0; i < GPLUS.size(); i++) sort(PPLUS[i][t].begin(), PPLUS[i][t].end());
      |                   ~~^~~~~~~~~~~~~~
fever.cpp:192:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  192 |   for (int i = 0; i < GMINS.size(); i++) sort(PMINS[i][t].begin(), PMINS[i][t].end());
      |                   ~~^~~~~~~~~~~~~~
fever.cpp:197:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  197 |   for (int i = 0; i < GX.size(); i++) henhari(PX[i][t], vector<int>{0, 0, 2, 0, 0, 0, 1, 0}, vector<int>{1, 1, 1, 1, 1, 1, 1, 1});
      |                   ~~^~~~~~~~~~~
fever.cpp:198:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  198 |   for (int i = 0; i < GY.size(); i++) henhari(PY[i][t], vector<int>{2, 0, 0, 0, 1, 0, 0, 0}, vector<int>{1, 1, 1, 1, 1, 1, 1, 1});
      |                   ~~^~~~~~~~~~~
fever.cpp:199:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  199 |   for (int i = 0; i < GPLUS.size(); i++) henhari(PPLUS[i][t], vector<int>{2, 0, 1, 0, 1, 0, 2, 0}, vector<int>{2, 1, 0, 1, 2, 1, 0, 1});
      |                   ~~^~~~~~~~~~~~~~
fever.cpp:200:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  200 |   for (int i = 0; i < GMINS.size(); i++) henhari(PMINS[i][t], vector<int>{2, 0, 2, 0, 1, 0, 1, 0}, vector<int>{0, 1, 2, 1, 0, 1, 2, 1});
      |                   ~~^~~~~~~~~~~~~~
fever.cpp:213:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  213 |    for (int i = 0; i < G[pos].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~
fever.cpp: In function 'int main()':
fever.cpp:245:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  245 |  scanf("%lld", &N);
      |  ~~~~~^~~~~~~~~~~~
fever.cpp:247:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  247 |   scanf("%lld%lld", &X[i], &Y[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
33 Correct 53 ms 56940 KB Output is correct
34 Correct 57 ms 56960 KB Output is correct
35 Correct 53 ms 56944 KB Output is correct
36 Correct 51 ms 56940 KB Output is correct
37 Correct 57 ms 56940 KB Output is correct
38 Correct 53 ms 56940 KB Output is correct
39 Correct 55 ms 56940 KB Output is correct
40 Correct 52 ms 56940 KB Output is correct
41 Correct 57 ms 56940 KB Output is correct
42 Correct 53 ms 56940 KB Output is correct
43 Correct 53 ms 56940 KB Output is correct
44 Correct 53 ms 56940 KB Output is correct
45 Correct 51 ms 56940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 52 ms 56940 KB Output is correct
3 Correct 52 ms 56940 KB Output is correct
4 Correct 52 ms 56940 KB Output is correct
5 Correct 56 ms 56940 KB Output is correct
6 Correct 56 ms 57068 KB Output is correct
7 Correct 55 ms 56940 KB Output is correct
8 Correct 52 ms 56940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
33 Correct 53 ms 56940 KB Output is correct
34 Correct 57 ms 56960 KB Output is correct
35 Correct 53 ms 56944 KB Output is correct
36 Correct 51 ms 56940 KB Output is correct
37 Correct 57 ms 56940 KB Output is correct
38 Correct 53 ms 56940 KB Output is correct
39 Correct 55 ms 56940 KB Output is correct
40 Correct 52 ms 56940 KB Output is correct
41 Correct 57 ms 56940 KB Output is correct
42 Correct 53 ms 56940 KB Output is correct
43 Correct 53 ms 56940 KB Output is correct
44 Correct 53 ms 56940 KB Output is correct
45 Correct 51 ms 56940 KB Output is correct
46 Correct 53 ms 56940 KB Output is correct
47 Correct 52 ms 56940 KB Output is correct
48 Correct 52 ms 56940 KB Output is correct
49 Correct 52 ms 56940 KB Output is correct
50 Correct 56 ms 56940 KB Output is correct
51 Correct 56 ms 57068 KB Output is correct
52 Correct 55 ms 56940 KB Output is correct
53 Correct 52 ms 56940 KB Output is correct
54 Correct 59 ms 56940 KB Output is correct
55 Correct 56 ms 56940 KB Output is correct
56 Correct 52 ms 56940 KB Output is correct
57 Correct 55 ms 57068 KB Output is correct
58 Correct 54 ms 56940 KB Output is correct
59 Correct 53 ms 56940 KB Output is correct
60 Correct 55 ms 56980 KB Output is correct
61 Correct 53 ms 56940 KB Output is correct
62 Correct 64 ms 56940 KB Output is correct
63 Correct 56 ms 56940 KB Output is correct
64 Correct 54 ms 56940 KB Output is correct
65 Correct 57 ms 56976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
33 Correct 53 ms 56940 KB Output is correct
34 Correct 57 ms 56960 KB Output is correct
35 Correct 53 ms 56944 KB Output is correct
36 Correct 51 ms 56940 KB Output is correct
37 Correct 57 ms 56940 KB Output is correct
38 Correct 53 ms 56940 KB Output is correct
39 Correct 55 ms 56940 KB Output is correct
40 Correct 52 ms 56940 KB Output is correct
41 Correct 57 ms 56940 KB Output is correct
42 Correct 53 ms 56940 KB Output is correct
43 Correct 53 ms 56940 KB Output is correct
44 Correct 53 ms 56940 KB Output is correct
45 Correct 51 ms 56940 KB Output is correct
46 Correct 53 ms 56940 KB Output is correct
47 Correct 52 ms 56940 KB Output is correct
48 Correct 52 ms 56940 KB Output is correct
49 Correct 52 ms 56940 KB Output is correct
50 Correct 56 ms 56940 KB Output is correct
51 Correct 56 ms 57068 KB Output is correct
52 Correct 55 ms 56940 KB Output is correct
53 Correct 52 ms 56940 KB Output is correct
54 Correct 59 ms 56940 KB Output is correct
55 Correct 56 ms 56940 KB Output is correct
56 Correct 52 ms 56940 KB Output is correct
57 Correct 55 ms 57068 KB Output is correct
58 Correct 54 ms 56940 KB Output is correct
59 Correct 53 ms 56940 KB Output is correct
60 Correct 55 ms 56980 KB Output is correct
61 Correct 53 ms 56940 KB Output is correct
62 Correct 64 ms 56940 KB Output is correct
63 Correct 56 ms 56940 KB Output is correct
64 Correct 54 ms 56940 KB Output is correct
65 Correct 57 ms 56976 KB Output is correct
66 Correct 81 ms 58348 KB Output is correct
67 Correct 79 ms 58276 KB Output is correct
68 Correct 80 ms 57964 KB Output is correct
69 Correct 72 ms 58348 KB Output is correct
70 Correct 69 ms 58604 KB Output is correct
71 Correct 76 ms 58476 KB Output is correct
72 Correct 78 ms 58244 KB Output is correct
73 Correct 81 ms 58092 KB Output is correct
74 Correct 76 ms 58604 KB Output is correct
75 Correct 80 ms 58604 KB Output is correct
76 Correct 77 ms 58220 KB Output is correct
77 Correct 78 ms 58476 KB Output is correct
78 Correct 83 ms 57964 KB Output is correct
79 Correct 81 ms 58000 KB Output is correct
80 Correct 78 ms 57836 KB Output is correct
81 Correct 76 ms 57708 KB Output is correct
82 Correct 91 ms 58732 KB Output is correct
83 Correct 76 ms 58444 KB Output is correct
84 Correct 66 ms 58860 KB Output is correct
85 Correct 69 ms 58860 KB Output is correct
86 Correct 62 ms 58732 KB Output is correct
87 Correct 66 ms 58864 KB Output is correct
88 Correct 68 ms 58648 KB Output is correct
89 Correct 74 ms 57580 KB Output is correct
90 Correct 76 ms 57580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
33 Correct 53 ms 56940 KB Output is correct
34 Correct 57 ms 56960 KB Output is correct
35 Correct 53 ms 56944 KB Output is correct
36 Correct 51 ms 56940 KB Output is correct
37 Correct 57 ms 56940 KB Output is correct
38 Correct 53 ms 56940 KB Output is correct
39 Correct 55 ms 56940 KB Output is correct
40 Correct 52 ms 56940 KB Output is correct
41 Correct 57 ms 56940 KB Output is correct
42 Correct 53 ms 56940 KB Output is correct
43 Correct 53 ms 56940 KB Output is correct
44 Correct 53 ms 56940 KB Output is correct
45 Correct 51 ms 56940 KB Output is correct
46 Correct 53 ms 56940 KB Output is correct
47 Correct 52 ms 56940 KB Output is correct
48 Correct 52 ms 56940 KB Output is correct
49 Correct 52 ms 56940 KB Output is correct
50 Correct 56 ms 56940 KB Output is correct
51 Correct 56 ms 57068 KB Output is correct
52 Correct 55 ms 56940 KB Output is correct
53 Correct 52 ms 56940 KB Output is correct
54 Correct 59 ms 56940 KB Output is correct
55 Correct 56 ms 56940 KB Output is correct
56 Correct 52 ms 56940 KB Output is correct
57 Correct 55 ms 57068 KB Output is correct
58 Correct 54 ms 56940 KB Output is correct
59 Correct 53 ms 56940 KB Output is correct
60 Correct 55 ms 56980 KB Output is correct
61 Correct 53 ms 56940 KB Output is correct
62 Correct 64 ms 56940 KB Output is correct
63 Correct 56 ms 56940 KB Output is correct
64 Correct 54 ms 56940 KB Output is correct
65 Correct 57 ms 56976 KB Output is correct
66 Correct 1088 ms 85056 KB Output is correct
67 Correct 1424 ms 100600 KB Output is correct
68 Correct 1436 ms 98732 KB Output is correct
69 Correct 1295 ms 112660 KB Output is correct
70 Correct 1403 ms 96292 KB Output is correct
71 Correct 1400 ms 91752 KB Output is correct
72 Correct 1394 ms 91536 KB Output is correct
73 Correct 1311 ms 107212 KB Output is correct
74 Correct 1403 ms 91504 KB Output is correct
75 Correct 1391 ms 90200 KB Output is correct
76 Correct 1222 ms 93604 KB Output is correct
77 Correct 1406 ms 87720 KB Output is correct
78 Correct 1245 ms 78484 KB Output is correct
79 Correct 1235 ms 78616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 56940 KB Output is correct
2 Correct 54 ms 56940 KB Output is correct
3 Correct 67 ms 56940 KB Output is correct
4 Correct 51 ms 56940 KB Output is correct
5 Correct 55 ms 57068 KB Output is correct
6 Correct 54 ms 56940 KB Output is correct
7 Correct 54 ms 56940 KB Output is correct
8 Correct 55 ms 56940 KB Output is correct
9 Correct 53 ms 56940 KB Output is correct
10 Correct 52 ms 56940 KB Output is correct
11 Correct 52 ms 56904 KB Output is correct
12 Correct 53 ms 56940 KB Output is correct
13 Correct 51 ms 56940 KB Output is correct
14 Correct 54 ms 56940 KB Output is correct
15 Correct 52 ms 56940 KB Output is correct
16 Correct 58 ms 57004 KB Output is correct
17 Correct 52 ms 56940 KB Output is correct
18 Correct 52 ms 56940 KB Output is correct
19 Correct 52 ms 56940 KB Output is correct
20 Correct 53 ms 56940 KB Output is correct
21 Correct 52 ms 56940 KB Output is correct
22 Correct 57 ms 56940 KB Output is correct
23 Correct 54 ms 56940 KB Output is correct
24 Correct 51 ms 56940 KB Output is correct
25 Correct 52 ms 56960 KB Output is correct
26 Correct 52 ms 56940 KB Output is correct
27 Correct 53 ms 56940 KB Output is correct
28 Correct 53 ms 56940 KB Output is correct
29 Correct 56 ms 56940 KB Output is correct
30 Correct 51 ms 56940 KB Output is correct
31 Correct 53 ms 56940 KB Output is correct
32 Correct 53 ms 56940 KB Output is correct
33 Correct 53 ms 56940 KB Output is correct
34 Correct 57 ms 56960 KB Output is correct
35 Correct 53 ms 56944 KB Output is correct
36 Correct 51 ms 56940 KB Output is correct
37 Correct 57 ms 56940 KB Output is correct
38 Correct 53 ms 56940 KB Output is correct
39 Correct 55 ms 56940 KB Output is correct
40 Correct 52 ms 56940 KB Output is correct
41 Correct 57 ms 56940 KB Output is correct
42 Correct 53 ms 56940 KB Output is correct
43 Correct 53 ms 56940 KB Output is correct
44 Correct 53 ms 56940 KB Output is correct
45 Correct 51 ms 56940 KB Output is correct
46 Correct 53 ms 56940 KB Output is correct
47 Correct 52 ms 56940 KB Output is correct
48 Correct 52 ms 56940 KB Output is correct
49 Correct 52 ms 56940 KB Output is correct
50 Correct 56 ms 56940 KB Output is correct
51 Correct 56 ms 57068 KB Output is correct
52 Correct 55 ms 56940 KB Output is correct
53 Correct 52 ms 56940 KB Output is correct
54 Correct 59 ms 56940 KB Output is correct
55 Correct 56 ms 56940 KB Output is correct
56 Correct 52 ms 56940 KB Output is correct
57 Correct 55 ms 57068 KB Output is correct
58 Correct 54 ms 56940 KB Output is correct
59 Correct 53 ms 56940 KB Output is correct
60 Correct 55 ms 56980 KB Output is correct
61 Correct 53 ms 56940 KB Output is correct
62 Correct 64 ms 56940 KB Output is correct
63 Correct 56 ms 56940 KB Output is correct
64 Correct 54 ms 56940 KB Output is correct
65 Correct 57 ms 56976 KB Output is correct
66 Correct 81 ms 58348 KB Output is correct
67 Correct 79 ms 58276 KB Output is correct
68 Correct 80 ms 57964 KB Output is correct
69 Correct 72 ms 58348 KB Output is correct
70 Correct 69 ms 58604 KB Output is correct
71 Correct 76 ms 58476 KB Output is correct
72 Correct 78 ms 58244 KB Output is correct
73 Correct 81 ms 58092 KB Output is correct
74 Correct 76 ms 58604 KB Output is correct
75 Correct 80 ms 58604 KB Output is correct
76 Correct 77 ms 58220 KB Output is correct
77 Correct 78 ms 58476 KB Output is correct
78 Correct 83 ms 57964 KB Output is correct
79 Correct 81 ms 58000 KB Output is correct
80 Correct 78 ms 57836 KB Output is correct
81 Correct 76 ms 57708 KB Output is correct
82 Correct 91 ms 58732 KB Output is correct
83 Correct 76 ms 58444 KB Output is correct
84 Correct 66 ms 58860 KB Output is correct
85 Correct 69 ms 58860 KB Output is correct
86 Correct 62 ms 58732 KB Output is correct
87 Correct 66 ms 58864 KB Output is correct
88 Correct 68 ms 58648 KB Output is correct
89 Correct 74 ms 57580 KB Output is correct
90 Correct 76 ms 57580 KB Output is correct
91 Correct 1088 ms 85056 KB Output is correct
92 Correct 1424 ms 100600 KB Output is correct
93 Correct 1436 ms 98732 KB Output is correct
94 Correct 1295 ms 112660 KB Output is correct
95 Correct 1403 ms 96292 KB Output is correct
96 Correct 1400 ms 91752 KB Output is correct
97 Correct 1394 ms 91536 KB Output is correct
98 Correct 1311 ms 107212 KB Output is correct
99 Correct 1403 ms 91504 KB Output is correct
100 Correct 1391 ms 90200 KB Output is correct
101 Correct 1222 ms 93604 KB Output is correct
102 Correct 1406 ms 87720 KB Output is correct
103 Correct 1245 ms 78484 KB Output is correct
104 Correct 1235 ms 78616 KB Output is correct
105 Correct 824 ms 100084 KB Output is correct
106 Correct 1053 ms 110576 KB Output is correct
107 Correct 1397 ms 90532 KB Output is correct
108 Correct 1177 ms 109280 KB Output is correct
109 Correct 934 ms 108040 KB Output is correct
110 Correct 1310 ms 103804 KB Output is correct
111 Correct 1390 ms 100724 KB Output is correct
112 Correct 1356 ms 92192 KB Output is correct
113 Correct 1361 ms 90384 KB Output is correct
114 Correct 1434 ms 109644 KB Output is correct
115 Correct 1257 ms 106280 KB Output is correct
116 Correct 1393 ms 92260 KB Output is correct
117 Correct 1391 ms 91112 KB Output is correct
118 Correct 1405 ms 95116 KB Output is correct
119 Correct 1268 ms 91988 KB Output is correct
120 Correct 1373 ms 88508 KB Output is correct
121 Correct 1367 ms 86428 KB Output is correct
122 Correct 1412 ms 85808 KB Output is correct
123 Correct 1251 ms 112380 KB Output is correct
124 Correct 1265 ms 110408 KB Output is correct
125 Correct 464 ms 118748 KB Output is correct
126 Correct 348 ms 124896 KB Output is correct
127 Correct 348 ms 110304 KB Output is correct
128 Correct 398 ms 128400 KB Output is correct
129 Correct 451 ms 116128 KB Output is correct