답안 #955363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955363 2024-03-30T08:36:12 Z Der_Vlapos 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
585 ms 54148 KB
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #include <x86intrin.h>

#include <bits/stdc++.h>
#include <chrono>
#include <random>

// @author: Vlapos

namespace operators
{
	template <typename T1, typename T2>
	std::istream &operator>>(std::istream &in, std::pair<T1, T2> &x)
	{
		in >> x.first >> x.second;
		return in;
	}

	template <typename T1, typename T2>
	std::ostream &operator<<(std::ostream &out, std::pair<T1, T2> x)
	{
		out << x.first << " " << x.second;
		return out;
	}

	template <typename T1>
	std::istream &operator>>(std::istream &in, std::vector<T1> &x)
	{
		for (auto &i : x)
			in >> i;
		return in;
	}

	template <typename T1>
	std::ostream &operator<<(std::ostream &out, std::vector<T1> &x)
	{
		for (auto &i : x)
			out << i << " ";
		return out;
	}

	template <typename T1>
	std::ostream &operator<<(std::ostream &out, std::set<T1> &x)
	{
		for (auto &i : x)
			out << i << " ";
		return out;
	}
}

// name spaces
using namespace std;
using namespace operators;
// end of name spaces

// defines
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define uint unsigned int
#define all(vc) vc.begin(), vc.end()
// end of defines

// usefull stuff

void boost()
{
	ios_base ::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

inline int getbit(int &x, int &bt) { return (x >> bt) & 1; }

const int dx4[4] = {-1, 0, 0, 1};
const int dy4[4] = {0, -1, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy8[8] = {-1, -0, 1, -1, 1, -1, 0, 1};

const ll INF = (1e17) + 500;
const int BIG = (1e9) * 2 + 100;
const int MAXN = (1e5) + 5;
const int MOD7 = (1e9) + 7;
const int MOD9 = (1e9) + 9;
const uint MODFFT = 998244353;

#define int ll

struct segTree
{
	struct Node
	{
		int mx = 0, op = 0;
	};
	vector<Node> tree;
	int sz = 0;

	void init(int n)
	{
		sz = 1;
		while (sz < n)
			sz *= 2;
		tree.resize(2 * sz);
	}

	void upd(int v, int val)
	{
		tree[v].op += val;
		tree[v].mx += val;
	}

	void push(int v, int lv, int rv)
	{
		if (rv - lv == 1 or tree[v].op == 0)
			return;
		upd(v * 2 + 1, tree[v].op);
		upd(v * 2 + 2, tree[v].op);
		tree[v].op = 0;
	}

	void updSeg(int l, int r, int val, int v, int lv, int rv)
	{
		push(v, lv, rv);
		if (l <= lv and rv <= r)
		{
			upd(v, val);
			return;
		}
		if (rv <= l or r <= lv)
			return;
		int m = (lv + rv) >> 1;
		updSeg(l, r, val, v * 2 + 1, lv, m);
		updSeg(l, r, val, v * 2 + 2, m, rv);
		tree[v].mx = max(tree[v * 2 + 1].mx, tree[v * 2 + 2].mx);
	}

	void updSeg(int l, int r, int val)
	{
		updSeg(l, r, val, 0, 0, sz);
	}

	int getPos(int pos, int v, int lv, int rv)
	{
		push(v, lv, rv);
		if (rv - lv == 1)
			return tree[v].mx;
		int m = (lv + rv) >> 1;
		if (pos < m)
			return getPos(pos, v * 2 + 1, lv, m);
		return getPos(pos, v * 2 + 2, m, rv);
	}

	int getPos(int pos)
	{
		return getPos(pos, 0, 0, sz);
	}

	int getGoodPos(int v, int lv, int rv)
	{
		push(v, lv, rv);
		if (rv - lv == 1)
			return lv;
		int m = (lv + rv) >> 1;
		if (tree[v * 2 + 1].mx >= 0)
			return getGoodPos(v * 2 + 1, lv, m);
		return getGoodPos(v * 2 + 2, m, rv);
	}

	int getGoodPos()
	{
		return getGoodPos(0, 0, sz);
	}
};

struct segTreeBF
{
	struct Node
	{
		int add = 0, del = 0;
	};
	vector<Node> tree;
	int sz = 0;

	void init(int n)
	{
		sz = 1;
		while (sz < n)
			sz *= 2;
		tree.resize(2 * sz);
	}

	void upd(int v, int val)
	{
		if (tree[v].add + val >= 0)
			tree[v].add = tree[v].add + val;
		else
		{
			tree[v].del += tree[v].add + val;
			tree[v].add = 0;
		}
	}

	void push(int v, int lv, int rv)
	{
		if (rv - lv == 1 or (tree[v].add == 0 and tree[v].del == 0))
			return;
		upd(v * 2 + 1, tree[v].del);
		upd(v * 2 + 1, tree[v].add);
		upd(v * 2 + 2, tree[v].del);
		upd(v * 2 + 2, tree[v].add);
		tree[v].add = tree[v].del = 0;
	}

	void updSeg(int l, int r, int val, int v, int lv, int rv)
	{
		push(v, lv, rv);
		if (l <= lv and rv <= r)
		{
			upd(v, val);
			return;
		}
		if (rv <= l or r <= lv)
			return;
		int m = (lv + rv) >> 1;
		updSeg(l, r, val, v * 2 + 1, lv, m);
		updSeg(l, r, val, v * 2 + 2, m, rv);
	}

	void updSeg(int l, int r, int val)
	{
		updSeg(l, r, val, 0, 0, sz);
	}

	int getPos(int pos, int v, int lv, int rv)
	{
		push(v, lv, rv);
		if (rv - lv == 1)
		{
			return tree[v].add;
		}
		int m = (lv + rv) >> 1;
		if (pos < m)
			return getPos(pos, v * 2 + 1, lv, m);
		return getPos(pos, v * 2 + 2, m, rv);
	}

	int getPos(int pos)
	{
		return getPos(pos, 0, 0, sz);
	}
};

struct test
{
	void solve(int testcase)
	{
		boost();
		int n, m, q;
		cin >> n >> m >> q;
		int cntA = 0;
		vector<vector<pair<int, int>>> ops(n);

		vector<pair<pii, pii>> updates;
		segTreeBF bf1, bf2;
		vector<int> ans;
		bf1.init(n);
		bf2.init(n);
		for (int i = 0; i < q; ++i)
		{
			int tp;
			cin >> tp;
			if (tp == 1)
			{
				int l, r, c, k;
				cin >> l >> r >> c >> k;
				--l;
				updates.pb({{l, r}, {c, k}});
				bf1.updSeg(l, r, k);
				bf2.updSeg(l, r, k);
			}
			else if (tp == 2)
			{
				int l, r, k;
				cin >> l >> r >> k;
				--l;
				bf2.updSeg(l, r, -k);
			}
			else
			{
				int p, val;
				cin >> p >> val;
				--p;
				int cntLeave = bf1.getPos(p) - bf2.getPos(p);
				ans.pb(0);
				if (bf2.getPos(p) >= val)
					ops[p].pb({cntLeave + val, cntA});
				cntA++;
			}
		}
		for (int i = 0; i < n; ++i)
			ops[i].pb({INF, BIG});
		segTree res;
		res.init(n + 1);
		vector<int> prev(n + 1);
		for (int i = 0; i < n; ++i)
		{
			sort(all(ops[i]));
			reverse(all(ops[i]));
			int val = ops[i].back().f;
			res.updSeg(i, i + 1, -val);
			prev[i] = -val;
		}

		for (auto [seg, vals] : updates)
		{
			res.updSeg(seg.f, seg.s, vals.s);
			int p = res.getGoodPos();
			while (p < n)
			{
				ans[ops[p].back().s] = vals.f;
				ops[p].pop_back();
				int val = ops[p].back().f;
				res.updSeg(p, p + 1, -prev[p] - val);
				prev[p] = -val;
				p = res.getGoodPos();
			}
		}

		for (auto el : ans)
			cout << el << '\n';
	}
};

main()
{
	boost();
	int q = 1;
	// cin >> q;
	for (int i = 0; i < q; i++)
	{
		test t;
		t.solve(i);
	}
	return 0;
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]//
//                                                                                    //
//                               Coded by Der_Vlἀpos                                  //
//                                                                                    //
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]//

Compilation message

foodcourt.cpp:340:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  340 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 600 KB Output is correct
22 Correct 3 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 4 ms 860 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 3 ms 604 KB Output is correct
31 Correct 3 ms 600 KB Output is correct
32 Correct 3 ms 604 KB Output is correct
33 Correct 2 ms 616 KB Output is correct
34 Correct 2 ms 616 KB Output is correct
35 Correct 2 ms 616 KB Output is correct
36 Correct 2 ms 624 KB Output is correct
37 Correct 2 ms 616 KB Output is correct
38 Correct 2 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 11552 KB Output is correct
2 Correct 71 ms 11768 KB Output is correct
3 Correct 69 ms 11444 KB Output is correct
4 Correct 69 ms 12632 KB Output is correct
5 Correct 78 ms 12972 KB Output is correct
6 Correct 75 ms 12880 KB Output is correct
7 Correct 14 ms 2532 KB Output is correct
8 Correct 15 ms 2352 KB Output is correct
9 Correct 68 ms 12840 KB Output is correct
10 Correct 70 ms 12840 KB Output is correct
11 Correct 68 ms 12824 KB Output is correct
12 Correct 69 ms 12696 KB Output is correct
13 Correct 61 ms 11536 KB Output is correct
14 Correct 76 ms 13188 KB Output is correct
15 Correct 75 ms 12256 KB Output is correct
16 Correct 82 ms 13784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 444 ms 43196 KB Output is correct
2 Correct 383 ms 40392 KB Output is correct
3 Correct 487 ms 45288 KB Output is correct
4 Correct 402 ms 44692 KB Output is correct
5 Correct 355 ms 41264 KB Output is correct
6 Correct 535 ms 46344 KB Output is correct
7 Correct 61 ms 6604 KB Output is correct
8 Correct 66 ms 6468 KB Output is correct
9 Correct 499 ms 47256 KB Output is correct
10 Correct 524 ms 47016 KB Output is correct
11 Correct 452 ms 44796 KB Output is correct
12 Correct 456 ms 44808 KB Output is correct
13 Correct 457 ms 46124 KB Output is correct
14 Correct 462 ms 44796 KB Output is correct
15 Correct 531 ms 45896 KB Output is correct
16 Correct 495 ms 45096 KB Output is correct
17 Correct 496 ms 45000 KB Output is correct
18 Correct 485 ms 45096 KB Output is correct
19 Correct 477 ms 45548 KB Output is correct
20 Correct 494 ms 44888 KB Output is correct
21 Correct 482 ms 45100 KB Output is correct
22 Correct 496 ms 45688 KB Output is correct
23 Correct 550 ms 44868 KB Output is correct
24 Correct 534 ms 45084 KB Output is correct
25 Correct 433 ms 42212 KB Output is correct
26 Correct 446 ms 45140 KB Output is correct
27 Correct 451 ms 47560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 71 ms 11552 KB Output is correct
22 Correct 71 ms 11768 KB Output is correct
23 Correct 69 ms 11444 KB Output is correct
24 Correct 69 ms 12632 KB Output is correct
25 Correct 78 ms 12972 KB Output is correct
26 Correct 75 ms 12880 KB Output is correct
27 Correct 14 ms 2532 KB Output is correct
28 Correct 15 ms 2352 KB Output is correct
29 Correct 68 ms 12840 KB Output is correct
30 Correct 70 ms 12840 KB Output is correct
31 Correct 68 ms 12824 KB Output is correct
32 Correct 69 ms 12696 KB Output is correct
33 Correct 61 ms 11536 KB Output is correct
34 Correct 76 ms 13188 KB Output is correct
35 Correct 75 ms 12256 KB Output is correct
36 Correct 82 ms 13784 KB Output is correct
37 Correct 94 ms 12228 KB Output is correct
38 Correct 85 ms 12292 KB Output is correct
39 Correct 12 ms 2368 KB Output is correct
40 Correct 15 ms 2364 KB Output is correct
41 Correct 97 ms 12916 KB Output is correct
42 Correct 92 ms 12800 KB Output is correct
43 Correct 102 ms 12840 KB Output is correct
44 Correct 94 ms 12908 KB Output is correct
45 Correct 104 ms 12840 KB Output is correct
46 Correct 101 ms 12836 KB Output is correct
47 Correct 59 ms 12608 KB Output is correct
48 Correct 89 ms 12744 KB Output is correct
49 Correct 69 ms 10804 KB Output is correct
50 Correct 91 ms 12340 KB Output is correct
51 Correct 97 ms 12852 KB Output is correct
52 Correct 101 ms 12824 KB Output is correct
53 Correct 64 ms 12516 KB Output is correct
54 Correct 80 ms 13800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 12244 KB Output is correct
2 Correct 95 ms 11732 KB Output is correct
3 Correct 103 ms 12500 KB Output is correct
4 Correct 80 ms 11536 KB Output is correct
5 Correct 89 ms 11984 KB Output is correct
6 Correct 110 ms 12548 KB Output is correct
7 Correct 17 ms 2268 KB Output is correct
8 Correct 17 ms 2336 KB Output is correct
9 Correct 69 ms 12376 KB Output is correct
10 Correct 69 ms 11376 KB Output is correct
11 Correct 109 ms 12364 KB Output is correct
12 Correct 108 ms 12500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 600 KB Output is correct
22 Correct 3 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 4 ms 860 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 3 ms 604 KB Output is correct
31 Correct 3 ms 600 KB Output is correct
32 Correct 3 ms 604 KB Output is correct
33 Correct 2 ms 616 KB Output is correct
34 Correct 2 ms 616 KB Output is correct
35 Correct 2 ms 616 KB Output is correct
36 Correct 2 ms 624 KB Output is correct
37 Correct 2 ms 616 KB Output is correct
38 Correct 2 ms 848 KB Output is correct
39 Correct 71 ms 11552 KB Output is correct
40 Correct 71 ms 11768 KB Output is correct
41 Correct 69 ms 11444 KB Output is correct
42 Correct 69 ms 12632 KB Output is correct
43 Correct 78 ms 12972 KB Output is correct
44 Correct 75 ms 12880 KB Output is correct
45 Correct 14 ms 2532 KB Output is correct
46 Correct 15 ms 2352 KB Output is correct
47 Correct 68 ms 12840 KB Output is correct
48 Correct 70 ms 12840 KB Output is correct
49 Correct 68 ms 12824 KB Output is correct
50 Correct 69 ms 12696 KB Output is correct
51 Correct 61 ms 11536 KB Output is correct
52 Correct 76 ms 13188 KB Output is correct
53 Correct 75 ms 12256 KB Output is correct
54 Correct 82 ms 13784 KB Output is correct
55 Correct 94 ms 12228 KB Output is correct
56 Correct 85 ms 12292 KB Output is correct
57 Correct 12 ms 2368 KB Output is correct
58 Correct 15 ms 2364 KB Output is correct
59 Correct 97 ms 12916 KB Output is correct
60 Correct 92 ms 12800 KB Output is correct
61 Correct 102 ms 12840 KB Output is correct
62 Correct 94 ms 12908 KB Output is correct
63 Correct 104 ms 12840 KB Output is correct
64 Correct 101 ms 12836 KB Output is correct
65 Correct 59 ms 12608 KB Output is correct
66 Correct 89 ms 12744 KB Output is correct
67 Correct 69 ms 10804 KB Output is correct
68 Correct 91 ms 12340 KB Output is correct
69 Correct 97 ms 12852 KB Output is correct
70 Correct 101 ms 12824 KB Output is correct
71 Correct 64 ms 12516 KB Output is correct
72 Correct 80 ms 13800 KB Output is correct
73 Correct 104 ms 12244 KB Output is correct
74 Correct 95 ms 11732 KB Output is correct
75 Correct 103 ms 12500 KB Output is correct
76 Correct 80 ms 11536 KB Output is correct
77 Correct 89 ms 11984 KB Output is correct
78 Correct 110 ms 12548 KB Output is correct
79 Correct 17 ms 2268 KB Output is correct
80 Correct 17 ms 2336 KB Output is correct
81 Correct 69 ms 12376 KB Output is correct
82 Correct 69 ms 11376 KB Output is correct
83 Correct 109 ms 12364 KB Output is correct
84 Correct 108 ms 12500 KB Output is correct
85 Correct 89 ms 12212 KB Output is correct
86 Correct 127 ms 13256 KB Output is correct
87 Correct 93 ms 13000 KB Output is correct
88 Correct 127 ms 13888 KB Output is correct
89 Correct 62 ms 11524 KB Output is correct
90 Correct 138 ms 13288 KB Output is correct
91 Correct 84 ms 11556 KB Output is correct
92 Correct 85 ms 11300 KB Output is correct
93 Correct 109 ms 13396 KB Output is correct
94 Correct 106 ms 13368 KB Output is correct
95 Correct 104 ms 12996 KB Output is correct
96 Correct 120 ms 13360 KB Output is correct
97 Correct 117 ms 13280 KB Output is correct
98 Correct 95 ms 11784 KB Output is correct
99 Correct 68 ms 13240 KB Output is correct
100 Correct 82 ms 12352 KB Output is correct
101 Correct 106 ms 13204 KB Output is correct
102 Correct 88 ms 13900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 600 KB Output is correct
22 Correct 3 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 4 ms 860 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 3 ms 604 KB Output is correct
31 Correct 3 ms 600 KB Output is correct
32 Correct 3 ms 604 KB Output is correct
33 Correct 2 ms 616 KB Output is correct
34 Correct 2 ms 616 KB Output is correct
35 Correct 2 ms 616 KB Output is correct
36 Correct 2 ms 624 KB Output is correct
37 Correct 2 ms 616 KB Output is correct
38 Correct 2 ms 848 KB Output is correct
39 Correct 71 ms 11552 KB Output is correct
40 Correct 71 ms 11768 KB Output is correct
41 Correct 69 ms 11444 KB Output is correct
42 Correct 69 ms 12632 KB Output is correct
43 Correct 78 ms 12972 KB Output is correct
44 Correct 75 ms 12880 KB Output is correct
45 Correct 14 ms 2532 KB Output is correct
46 Correct 15 ms 2352 KB Output is correct
47 Correct 68 ms 12840 KB Output is correct
48 Correct 70 ms 12840 KB Output is correct
49 Correct 68 ms 12824 KB Output is correct
50 Correct 69 ms 12696 KB Output is correct
51 Correct 61 ms 11536 KB Output is correct
52 Correct 76 ms 13188 KB Output is correct
53 Correct 75 ms 12256 KB Output is correct
54 Correct 82 ms 13784 KB Output is correct
55 Correct 444 ms 43196 KB Output is correct
56 Correct 383 ms 40392 KB Output is correct
57 Correct 487 ms 45288 KB Output is correct
58 Correct 402 ms 44692 KB Output is correct
59 Correct 355 ms 41264 KB Output is correct
60 Correct 535 ms 46344 KB Output is correct
61 Correct 61 ms 6604 KB Output is correct
62 Correct 66 ms 6468 KB Output is correct
63 Correct 499 ms 47256 KB Output is correct
64 Correct 524 ms 47016 KB Output is correct
65 Correct 452 ms 44796 KB Output is correct
66 Correct 456 ms 44808 KB Output is correct
67 Correct 457 ms 46124 KB Output is correct
68 Correct 462 ms 44796 KB Output is correct
69 Correct 531 ms 45896 KB Output is correct
70 Correct 495 ms 45096 KB Output is correct
71 Correct 496 ms 45000 KB Output is correct
72 Correct 485 ms 45096 KB Output is correct
73 Correct 477 ms 45548 KB Output is correct
74 Correct 494 ms 44888 KB Output is correct
75 Correct 482 ms 45100 KB Output is correct
76 Correct 496 ms 45688 KB Output is correct
77 Correct 550 ms 44868 KB Output is correct
78 Correct 534 ms 45084 KB Output is correct
79 Correct 433 ms 42212 KB Output is correct
80 Correct 446 ms 45140 KB Output is correct
81 Correct 451 ms 47560 KB Output is correct
82 Correct 94 ms 12228 KB Output is correct
83 Correct 85 ms 12292 KB Output is correct
84 Correct 12 ms 2368 KB Output is correct
85 Correct 15 ms 2364 KB Output is correct
86 Correct 97 ms 12916 KB Output is correct
87 Correct 92 ms 12800 KB Output is correct
88 Correct 102 ms 12840 KB Output is correct
89 Correct 94 ms 12908 KB Output is correct
90 Correct 104 ms 12840 KB Output is correct
91 Correct 101 ms 12836 KB Output is correct
92 Correct 59 ms 12608 KB Output is correct
93 Correct 89 ms 12744 KB Output is correct
94 Correct 69 ms 10804 KB Output is correct
95 Correct 91 ms 12340 KB Output is correct
96 Correct 97 ms 12852 KB Output is correct
97 Correct 101 ms 12824 KB Output is correct
98 Correct 64 ms 12516 KB Output is correct
99 Correct 80 ms 13800 KB Output is correct
100 Correct 104 ms 12244 KB Output is correct
101 Correct 95 ms 11732 KB Output is correct
102 Correct 103 ms 12500 KB Output is correct
103 Correct 80 ms 11536 KB Output is correct
104 Correct 89 ms 11984 KB Output is correct
105 Correct 110 ms 12548 KB Output is correct
106 Correct 17 ms 2268 KB Output is correct
107 Correct 17 ms 2336 KB Output is correct
108 Correct 69 ms 12376 KB Output is correct
109 Correct 69 ms 11376 KB Output is correct
110 Correct 109 ms 12364 KB Output is correct
111 Correct 108 ms 12500 KB Output is correct
112 Correct 89 ms 12212 KB Output is correct
113 Correct 127 ms 13256 KB Output is correct
114 Correct 93 ms 13000 KB Output is correct
115 Correct 127 ms 13888 KB Output is correct
116 Correct 62 ms 11524 KB Output is correct
117 Correct 138 ms 13288 KB Output is correct
118 Correct 84 ms 11556 KB Output is correct
119 Correct 85 ms 11300 KB Output is correct
120 Correct 109 ms 13396 KB Output is correct
121 Correct 106 ms 13368 KB Output is correct
122 Correct 104 ms 12996 KB Output is correct
123 Correct 120 ms 13360 KB Output is correct
124 Correct 117 ms 13280 KB Output is correct
125 Correct 95 ms 11784 KB Output is correct
126 Correct 68 ms 13240 KB Output is correct
127 Correct 82 ms 12352 KB Output is correct
128 Correct 106 ms 13204 KB Output is correct
129 Correct 88 ms 13900 KB Output is correct
130 Correct 585 ms 51180 KB Output is correct
131 Correct 380 ms 44604 KB Output is correct
132 Correct 498 ms 52168 KB Output is correct
133 Correct 554 ms 51652 KB Output is correct
134 Correct 468 ms 50576 KB Output is correct
135 Correct 571 ms 52872 KB Output is correct
136 Correct 560 ms 54148 KB Output is correct
137 Correct 524 ms 54080 KB Output is correct
138 Correct 462 ms 52336 KB Output is correct
139 Correct 469 ms 51656 KB Output is correct
140 Correct 519 ms 53256 KB Output is correct
141 Correct 500 ms 51736 KB Output is correct
142 Correct 510 ms 52248 KB Output is correct
143 Correct 527 ms 51648 KB Output is correct
144 Correct 498 ms 51632 KB Output is correct
145 Correct 474 ms 51892 KB Output is correct
146 Correct 514 ms 51484 KB Output is correct
147 Correct 520 ms 51556 KB Output is correct
148 Correct 544 ms 51820 KB Output is correct
149 Correct 524 ms 51512 KB Output is correct
150 Correct 315 ms 51416 KB Output is correct
151 Correct 411 ms 51644 KB Output is correct
152 Correct 442 ms 52276 KB Output is correct
153 Correct 366 ms 53356 KB Output is correct