Submission #521623

# Submission time Handle Problem Language Result Execution time Memory
521623 2022-02-02T15:08:51 Z amunduzbaev IOI Fever (JOI21_fever) C++14
100 / 100
2172 ms 54864 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;

// returns number of elements strictly smaller than v in vec
template<class T>
int bins(const vector<T>& vec, T v) {
	int low = 0;
	int high = vec.size();
	while(low != high) {
		int mid = (low + high) >> 1;
		if (vec[mid] < v) low = mid + 1;
		else high = mid;
	}
	return low;
}

// Struct for priority queue operations on index set [0, n-1]
// push(i, v) overwrites value at position i if one already exists
// decKey is faster but requires that the new key is smaller than the old one
struct Prique {
	const ll INF = (ll)1e18;
	vector<pair<ll, int>> data;
	const int n;

	Prique(int siz) : n(siz), data(2*siz, {INF, -1}) { data[0] = {-INF, -1}; }
	bool empty() const { return data[1].second >= INF; }
	pair<ll, int> top() const { return data[1]; }

	void push(int i, ll v) {
		data[i+n] = {v, (v >= INF ? -1 : i)};
		for (i += n; i > 1; i >>= 1) data[i>>1] = min(data[i], data[i^1]);
	}
	void decKey(int i, ll v) {
		for (int j = i+n; data[j].first > v; j >>= 1) data[j] = {v, i};
	}
	pair<ll, int> pop() {
		auto res = data[1];
		push(res.second, INF);
		return res;
	}
};

// Segment tree for range minimum and range capping
class SegTree {
	private:
		const ll INF = (ll)1e18;
		vector<ll> mn, cap, base;
		int h = 1;

		void apply(int i, ll v) {
			cap[i] = min(cap[i], v);
			mn[i] = min(mn[i], base[i] + cap[i]);
		}
		void push(int i) {
			apply(2*i, cap[i]);
			apply(2*i+1, cap[i]);
			cap[i] = INF;
		}

		void recApply(int a, int b, ll v, int i, int ia, int ib) {
			if (ib <= a || b <= ia) return;
			if (a <= ia && ib <= b) {
				apply(i, v);
			} else {
				push(i);
				int im = (ia + ib) >> 1;
				recApply(a, b, v, 2*i, ia, im);
				recApply(a, b, v, 2*i+1, im, ib);
				mn[i] = min(mn[2*i], mn[2*i+1]);
			}
		}
	public:
		SegTree(int n) {
			while(h < n) h *= 2;
			mn.resize(2*h, 2*INF); base.resize(2*h, INF); cap.resize(2*h, INF); 
		}
		void rangeCap(int a, int b, ll v) { recApply(a, b+1, v, 1, 0, h); }
		ll getMinVal() { return mn[1]; }
		
		void setBase(int i, ll v) {
			i += h;
			base[i] = v;
			mn[i] = base[i] + cap[i];
			for (i >>= 1; i > 0; i >>= 1) {
				base[i] = min(base[2*i], base[2*i+1]);
				mn[i] = min(cap[i] + base[i], min(mn[2*i], mn[2*i+1]));
			}
		}

		pair<ll, int> getMin() {
			int i = 1;
			ll res = mn[1];
			while(i < h) {
				push(i);
				if (mn[2*i] == mn[i]) i = 2*i;
				else i = 2*i+1;
			}
			return {res, i - h};
		}
};

pair<int, int> rotate(pair<int, int> dir) {
	return {dir.second, -dir.first};
}
int sign(ll v) {
	return (v < 0 ? -1 : v > 0);
}

int solve(const vector<pair<ll, ll>>& pts) {
	int n = pts.size();
	vector<int> dir(n); // RIGHT DOWN LEFT UP
	dir[0] = 0;
	for (int i = 1; i < n; ++i) {
		ll dx = pts[i].first, dy = pts[i].second;
		if (abs(dx) > abs(dy)) {
			if (dx < 0) dir[i] = 0;
			else dir[i] = 2;
		} else if (abs(dy) > abs(dx) || dx > 0) {
			if (dy < 0) dir[i] = 3;
			else dir[i] = 1;
		} else {
			dir[i] = 0;
		}
	}

	vector<pair<int, int>> diffs(8);
	diffs[0] = {1, 0};
	diffs[1] = {1, -1};
	diffs[2] = {0, -1};
	diffs[3] = {-1, -1};
	diffs[4] = {-1, 0};
	diffs[5] = {-1, 1};
	diffs[6] = {0, 1};
	diffs[7] = {1, 1};
	
	vector<vector<array<ll, 4>>> ords(8);
	for (int i = 0; i < n; ++i) {
		int dx = sign(diffs[2*dir[i]].first);
		int dy = sign(diffs[2*dir[i]].second);
		for (int j = 0; j < 8; ++j) {
			if (sign(diffs[j].first) != -dx && sign(diffs[j].second) != -dy) continue;
			array<ll, 4> off;
			off[0] = dir[i];
			
			pair<int, int> tar = diffs[j];
			pair<int, int> ortho = rotate(tar);
			off[1] = ortho.first * pts[i].first + ortho.second * pts[i].second;
			off[2] = tar.first * pts[i].first + tar.second * pts[i].second;
			off[3] = i;

			ords[j].push_back(off);
		}
	}
	for (int j = 0; j < 8; ++j) sort(ords[j].begin(), ords[j].end());
	
	vector<SegTree> segs;
	for (int j = 0; j < 8; ++j) {
		segs.emplace_back(ords[j].size());
		for (int i = 0; i < ords[j].size(); ++i) {
			if (ords[j][i][3] == 0) {
				segs[j].setBase(i, 0);
				segs[j].rangeCap(i, i, 0);
			} else {
				segs[j].setBase(i, ords[j][i][2]);
			}
		}
	}

	Prique pq(8);
	for (int j = 0; j < 8; ++j) pq.decKey(j, segs[j].getMin().first);

	vector<ll> times(n, INF);
	
	for (int j = pq.pop().second; j != -1; j = pq.pop().second) {
		auto opt = segs[j].getMin();
		segs[j].setBase(opt.second, INF);
		pq.decKey(j, segs[j].getMinVal());

		int i = ords[j][opt.second][3];
		ll t = opt.first;

		if (t >= INF / 2) break;
		if (t >= times[i]) continue;
		times[i] = t;
		
		int d = dir[i];
		for (int j2 = 0; j2 < 8; ++j2) {
			array<ll, 4> ind;

			// Desired direction
			if (j2 == (2*d+7) % 8) ind[0] = (d+1) % 4;
			else if (j2 == 2*d) ind[0] = (d + 2) % 4;
			else if (j2 == (2*d+1) % 8) ind[0] = (d+3) % 4;
			else continue;

			// Desired line
			pair<int, int> ortho = rotate(diffs[j2]);
			ind[1] = ortho.first * pts[i].first + ortho.second * pts[i].second;

			// Desired min coordinate
			ll base = diffs[j2].first * pts[i].first + diffs[j2].second * pts[i].second;
			ind[2] = t + base;

			// OK indices
			ind[3] = -1;
			
			int i0 = bins(ords[j2], ind);

			ind[2] = INF;
			
			int i1 = bins(ords[j2], ind);

			segs[j2].rangeCap(i0, i1 - 1, -base);
			pq.decKey(j2, segs[j2].getMinVal());
		}
	}

	int res = 0;
	for (ll& v : times) res += (v < INF);
	return res;
}

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

	int n;
	cin >> n;

	vector<pair<ll, ll>> pts(n);
	for (int i = 0; i < n; ++i) {
		int y, x;
		cin >> y >> x;
		pts[i] = {y, x};
	}
	for (int i = 1; i < n; ++i) {
		pts[i].first -= pts[0].first;
		pts[i].second -= pts[0].second;
	}
	pts[0] = {0, 0};

	// Decide direction person 1 goes to
	int res = 0;
	res = max(res, solve(pts)); // Right
	for (auto& pr : pts) pr.first = -pr.first;
	res = max(res, solve(pts)); // Left
	for (auto& pr : pts) swap(pr.first, pr.second);
	res = max(res, solve(pts)); // Up
	for (auto& pr : pts) pr.first = -pr.first;
	res = max(res, solve(pts)); // Down

	cout << res << '\n';
}

Compilation message

fever.cpp: In constructor 'Prique::Prique(int)':
fever.cpp:25:12: warning: 'Prique::n' will be initialized after [-Wreorder]
   25 |  const int n;
      |            ^
fever.cpp:24:24: warning:   'std::vector<std::pair<long long int, int> > Prique::data' [-Wreorder]
   24 |  vector<pair<ll, int>> data;
      |                        ^~~~
fever.cpp:27:2: warning:   when initialized here [-Wreorder]
   27 |  Prique(int siz) : n(siz), data(2*siz, {INF, -1}) { data[0] = {-INF, -1}; }
      |  ^~~~~~
fever.cpp: In function 'int solve(const std::vector<std::pair<long long int, long long int> >&)':
fever.cpp:161:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 4> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  161 |   for (int i = 0; i < ords[j].size(); ++i) {
      |                   ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 292 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 308 KB Output is correct
37 Correct 0 ms 312 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 312 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 292 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 308 KB Output is correct
37 Correct 0 ms 312 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 312 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 288 KB Output is correct
46 Correct 1 ms 308 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 316 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 304 KB Output is correct
51 Correct 1 ms 312 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 332 KB Output is correct
54 Correct 1 ms 316 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 316 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 312 KB Output is correct
61 Correct 1 ms 332 KB Output is correct
62 Correct 1 ms 312 KB Output is correct
63 Correct 1 ms 308 KB Output is correct
64 Correct 1 ms 332 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 292 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 308 KB Output is correct
37 Correct 0 ms 312 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 312 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 288 KB Output is correct
46 Correct 1 ms 308 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 316 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 304 KB Output is correct
51 Correct 1 ms 312 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 332 KB Output is correct
54 Correct 1 ms 316 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 316 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 312 KB Output is correct
61 Correct 1 ms 332 KB Output is correct
62 Correct 1 ms 312 KB Output is correct
63 Correct 1 ms 308 KB Output is correct
64 Correct 1 ms 332 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 9 ms 1556 KB Output is correct
67 Correct 12 ms 1868 KB Output is correct
68 Correct 9 ms 1704 KB Output is correct
69 Correct 30 ms 1792 KB Output is correct
70 Correct 15 ms 1532 KB Output is correct
71 Correct 11 ms 1608 KB Output is correct
72 Correct 10 ms 1612 KB Output is correct
73 Correct 10 ms 1740 KB Output is correct
74 Correct 11 ms 1764 KB Output is correct
75 Correct 17 ms 1744 KB Output is correct
76 Correct 13 ms 1616 KB Output is correct
77 Correct 11 ms 1740 KB Output is correct
78 Correct 11 ms 1664 KB Output is correct
79 Correct 11 ms 1744 KB Output is correct
80 Correct 9 ms 1704 KB Output is correct
81 Correct 11 ms 1672 KB Output is correct
82 Correct 15 ms 1680 KB Output is correct
83 Correct 15 ms 1756 KB Output is correct
84 Correct 9 ms 1708 KB Output is correct
85 Correct 10 ms 1696 KB Output is correct
86 Correct 9 ms 1496 KB Output is correct
87 Correct 10 ms 1684 KB Output is correct
88 Correct 10 ms 1804 KB Output is correct
89 Correct 14 ms 1664 KB Output is correct
90 Correct 14 ms 1672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 292 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 308 KB Output is correct
37 Correct 0 ms 312 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 312 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 288 KB Output is correct
46 Correct 1 ms 308 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 316 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 304 KB Output is correct
51 Correct 1 ms 312 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 332 KB Output is correct
54 Correct 1 ms 316 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 316 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 312 KB Output is correct
61 Correct 1 ms 332 KB Output is correct
62 Correct 1 ms 312 KB Output is correct
63 Correct 1 ms 308 KB Output is correct
64 Correct 1 ms 332 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 319 ms 37924 KB Output is correct
67 Correct 397 ms 44900 KB Output is correct
68 Correct 397 ms 46756 KB Output is correct
69 Correct 496 ms 45176 KB Output is correct
70 Correct 791 ms 44096 KB Output is correct
71 Correct 404 ms 45944 KB Output is correct
72 Correct 398 ms 45128 KB Output is correct
73 Correct 485 ms 51244 KB Output is correct
74 Correct 403 ms 46292 KB Output is correct
75 Correct 409 ms 44992 KB Output is correct
76 Correct 565 ms 45068 KB Output is correct
77 Correct 392 ms 45096 KB Output is correct
78 Correct 620 ms 44956 KB Output is correct
79 Correct 614 ms 45136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 312 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 308 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 292 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 308 KB Output is correct
37 Correct 0 ms 312 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 312 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 288 KB Output is correct
46 Correct 1 ms 308 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 316 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 304 KB Output is correct
51 Correct 1 ms 312 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 332 KB Output is correct
54 Correct 1 ms 316 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 316 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 312 KB Output is correct
61 Correct 1 ms 332 KB Output is correct
62 Correct 1 ms 312 KB Output is correct
63 Correct 1 ms 308 KB Output is correct
64 Correct 1 ms 332 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 9 ms 1556 KB Output is correct
67 Correct 12 ms 1868 KB Output is correct
68 Correct 9 ms 1704 KB Output is correct
69 Correct 30 ms 1792 KB Output is correct
70 Correct 15 ms 1532 KB Output is correct
71 Correct 11 ms 1608 KB Output is correct
72 Correct 10 ms 1612 KB Output is correct
73 Correct 10 ms 1740 KB Output is correct
74 Correct 11 ms 1764 KB Output is correct
75 Correct 17 ms 1744 KB Output is correct
76 Correct 13 ms 1616 KB Output is correct
77 Correct 11 ms 1740 KB Output is correct
78 Correct 11 ms 1664 KB Output is correct
79 Correct 11 ms 1744 KB Output is correct
80 Correct 9 ms 1704 KB Output is correct
81 Correct 11 ms 1672 KB Output is correct
82 Correct 15 ms 1680 KB Output is correct
83 Correct 15 ms 1756 KB Output is correct
84 Correct 9 ms 1708 KB Output is correct
85 Correct 10 ms 1696 KB Output is correct
86 Correct 9 ms 1496 KB Output is correct
87 Correct 10 ms 1684 KB Output is correct
88 Correct 10 ms 1804 KB Output is correct
89 Correct 14 ms 1664 KB Output is correct
90 Correct 14 ms 1672 KB Output is correct
91 Correct 319 ms 37924 KB Output is correct
92 Correct 397 ms 44900 KB Output is correct
93 Correct 397 ms 46756 KB Output is correct
94 Correct 496 ms 45176 KB Output is correct
95 Correct 791 ms 44096 KB Output is correct
96 Correct 404 ms 45944 KB Output is correct
97 Correct 398 ms 45128 KB Output is correct
98 Correct 485 ms 51244 KB Output is correct
99 Correct 403 ms 46292 KB Output is correct
100 Correct 409 ms 44992 KB Output is correct
101 Correct 565 ms 45068 KB Output is correct
102 Correct 392 ms 45096 KB Output is correct
103 Correct 620 ms 44956 KB Output is correct
104 Correct 614 ms 45136 KB Output is correct
105 Correct 1045 ms 34224 KB Output is correct
106 Correct 1257 ms 43920 KB Output is correct
107 Correct 2172 ms 43720 KB Output is correct
108 Correct 1339 ms 43744 KB Output is correct
109 Correct 419 ms 43848 KB Output is correct
110 Correct 396 ms 44228 KB Output is correct
111 Correct 406 ms 44540 KB Output is correct
112 Correct 407 ms 45084 KB Output is correct
113 Correct 391 ms 43912 KB Output is correct
114 Correct 1267 ms 49948 KB Output is correct
115 Correct 470 ms 54864 KB Output is correct
116 Correct 418 ms 44536 KB Output is correct
117 Correct 429 ms 44260 KB Output is correct
118 Correct 887 ms 44808 KB Output is correct
119 Correct 721 ms 45072 KB Output is correct
120 Correct 385 ms 44088 KB Output is correct
121 Correct 429 ms 44748 KB Output is correct
122 Correct 532 ms 45192 KB Output is correct
123 Correct 642 ms 44424 KB Output is correct
124 Correct 655 ms 46236 KB Output is correct
125 Correct 346 ms 46668 KB Output is correct
126 Correct 392 ms 43992 KB Output is correct
127 Correct 414 ms 44772 KB Output is correct
128 Correct 383 ms 46376 KB Output is correct
129 Correct 372 ms 48344 KB Output is correct