답안 #794191

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794191 2023-07-26T10:26:54 Z ymm 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
514 ms 56860 KB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
//typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
using namespace std;

const int N = 250'010;
const ll inf = 1e18;

namespace beats {
	struct node {
		ll lzyadd, lzyaddmn;
		ll mn, mn2;
	} t[4*N];
	int sz;

	void up(int i, ll add, ll addmn) {
		t[i].lzyadd += add;
		t[i].mn += add;
		t[i].mn2 += add;
		t[i].lzyaddmn += addmn;
		t[i].mn += addmn;
	}
	void ppg(int i) {
		up(2*i+1, t[i].lzyadd, t[2*i+1].mn + t[i].lzyadd + t[i].lzyaddmn == t[i].mn? t[i].lzyaddmn: 0);
		up(2*i+2, t[i].lzyadd, t[2*i+2].mn + t[i].lzyadd + t[i].lzyaddmn == t[i].mn? t[i].lzyaddmn: 0);
		t[i].lzyadd = 0;
		t[i].lzyaddmn = 0;
	}
	void merge(int i) {
		node &v = t[i], &l = t[2*i+1], &r = t[2*i+2];
		v.mn = min(l.mn, r.mn);
		if (l.mn < r.mn)
			v.mn2 = min(l.mn2, r.mn);
		if (l.mn > r.mn)
			v.mn2 = min(l.mn, r.mn2);
		if (l.mn == r.mn)
			v.mn2 = min(l.mn2, r.mn2);
	}
	void init(int n) {
		sz = n;
		Loop (i,0,4*sz) {
			t[i].lzyadd = 0;
			t[i].lzyaddmn = 0;
			t[i].mn = 0;
			t[i].mn2 = inf;
		}
	}
	void add(int l, int r, ll x, int i, int b, int e) {
		if (l <= b && e <= r) {
			up(i, x, 0);
			return;
		}
		if (r <= b || e <= l)
			return;
		ppg(i);
		add(l, r, x, 2*i+1, b, (b+e)/2);
		add(l, r, x, 2*i+2, (b+e)/2, e);
		merge(i);
	}

	void mvup(int i, int b, int e) {
		if (t[i].mn >= 0)
			return;
		if (t[i].mn2 > 0) {
			up(i, 0, -t[i].mn);
			return;
		}
		ppg(i);
		mvup(2*i+1, b, (b+e)/2);
		mvup(2*i+2, (b+e)/2, e);
		merge(i);
	}

	void add(int l, int r, ll x) {
		add(l, r, x, 0, 0, sz);
		mvup(0, 0, sz);
	}

	ll get(int p, int i, int b, int e) {
		if (e-b == 1)
			return t[i].mn;
		ppg(i);
		if (p < (b+e)/2)
			return get(p, 2*i+1, b, (b+e)/2);
		else
			return get(p, 2*i+2, (b+e)/2, e);
	}
	ll get(int p) { return get(p, 0, 0, sz); }
}

namespace seg {
	struct node {
		ll cnt;
		int l, r;
	} nd[(1<<28)/sizeof(node)];
	int nxt = 1;
	vector<pair<int,int>> rts;
	int sz;

	void init(int n) {
		sz = n;
		rts = {{0,-1}};
	}
	int add(int t, int l, int r, ll x, int b, int e) {
		int ans = nxt++;
		if (l <= b && e <= r) {
			nd[ans].cnt = nd[t].cnt + x;
			nd[ans].l = nd[t].l;
			nd[ans].r = nd[t].r;
			return ans;
		}
		nd[ans] = nd[t];
		if (l < (b+e)/2)
			nd[ans].l = add(nd[t].l, l, r, x, b, (b+e)/2);
		if ((b+e)/2 < r)
			nd[ans].r = add(nd[t].r, l, r, x, (b+e)/2, e);
		return ans;
	}
	ll get(int t, int p, int b, int e) {
		if (!t)
			return 0;
		if (e-b == 1)
			return nd[t].cnt;
		if (p < (b+e)/2)
			return nd[t].cnt + get(nd[t].l, p, b, (b+e)/2);
		else
			return nd[t].cnt + get(nd[t].r, p, (b+e)/2, e);
	}
	void add(int l, int r, ll x, int c) {
		int rt = rts.back().first;
		int rt2 = add(rt, l, r, x, 0, sz);
		rts.push_back({rt2, c});
	}
	ll get(int p) { return get(rts.back().first, p, 0, sz); }
	int bin(int p, ll i) {
		int l = 1, r = rts.size()-1;
		while (l < r) {
			int m = (l+r)/2;
			if (get(rts[m].first, p, 0, sz) > i)
				r = m;
			else
				l = m+1;
		}
		return rts[l].second;
	}
}

namespace fen {
	ll a[N];
	void add(int r, ll x) {
		while (r > 0) {
			a[r] += x;
			r -= r&-r;
		}
	}
	void add(int l, int r, ll x) {
		add(r, x);
		add(l, -x);
	}
	ll get(int i) {
		++i;
		ll ans = 0;
		while (i < N) {
			ans += a[i];
			i += i&-i;
		}
		return ans;
	}
}

vector<tuple<ll,int,int,int>> Q;
vector<pair<ll,int>> Q2;
namespace pbs {
	int L[N], R[N];
	int ans[N];
	vector<int> vec[N];
	
	void Do() {
		memset(fen::a, 0, sizeof(fen::a));
		Loop (i,0,Q.size()) {
			auto [x, l, r, c] = Q[i];
			fen::add(l, r, x);
			for (int j : vec[i]) {
				auto [y, pos] = Q2[j];
				ans[j] = fen::get(pos) > y;
			}
			vec[i].clear();
		}
	}
}

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int n, m, q;
	cin >> n >> m >> q;
	seg::init(n);
	beats::init(n);
	Loop (i,0,q) {
		int t;
		cin >> t;
		if (t == 1) {
			int l, r, c, k;
			cin >> l >> r >> c >> k;
			--l;
			Q.push_back({k,l,r,c});
			fen::add(l,r,k);
			beats::add(l, r, k);
		}
		if (t == 2) {
			int l, r, k;
			cin >> l >> r >> k;
			--l;
			beats::add(l, r, -k);
		}
		if (t == 3) {
			ll a, b;
			cin >> a >> b;
			--a; --b;
			ll cur = beats::get(a);
			ll tot = fen::get(a);
			b += tot - cur;
			pbs::L[Q2.size()] = 0;
			pbs::R[Q2.size()] = Q.size()-1;
			if (b >= tot)
				Q2.push_back({-1, -1});
			else
				Q2.push_back({b, a});
		}
	}
	Loop (_,0,20) {
		Loop (i,0,Q2.size()) {
			if (Q2[i].first == -1)
				continue;
			int l = pbs::L[i];
			int r = pbs::R[i];
			if (l == r)
				continue;
			int m = (l+r)/2;
			pbs::vec[m].push_back(i);
		}
		pbs::Do();
		Loop (i,0,Q2.size()) {
			if (Q2[i].first == -1)
				continue;
			int l = pbs::L[i];
			int r = pbs::R[i];
			if (l == r)
				continue;
			int m = (l+r)/2;
			if (pbs::ans[i])
				pbs::R[i] = m;
			else
				pbs::L[i] = m+1;
		}
	}
	Loop (i,0,Q2.size()) {
		if (Q2[i].first == -1)
			cout << "0\n";
		else
			cout << get<3>(Q[pbs::L[i]]) << '\n';
	}
}

Compilation message

foodcourt.cpp: In function 'void pbs::Do()':
foodcourt.cpp:2:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::tuple<long long int, int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
      |                                        ^
foodcourt.cpp:183:3: note: in expansion of macro 'Loop'
  183 |   Loop (i,0,Q.size()) {
      |   ^~~~
foodcourt.cpp: In function 'int main()':
foodcourt.cpp:2:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
      |                                        ^
foodcourt.cpp:235:3: note: in expansion of macro 'Loop'
  235 |   Loop (i,0,Q2.size()) {
      |   ^~~~
foodcourt.cpp:2:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
      |                                        ^
foodcourt.cpp:246:3: note: in expansion of macro 'Loop'
  246 |   Loop (i,0,Q2.size()) {
      |   ^~~~
foodcourt.cpp:2:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
      |                                        ^
foodcourt.cpp:260:2: note: in expansion of macro 'Loop'
  260 |  Loop (i,0,Q2.size()) {
      |  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8404 KB Output is correct
2 Correct 7 ms 8404 KB Output is correct
3 Correct 6 ms 8420 KB Output is correct
4 Correct 6 ms 8532 KB Output is correct
5 Correct 5 ms 8276 KB Output is correct
6 Correct 5 ms 8148 KB Output is correct
7 Correct 6 ms 8532 KB Output is correct
8 Correct 6 ms 8532 KB Output is correct
9 Correct 7 ms 8404 KB Output is correct
10 Correct 6 ms 8532 KB Output is correct
11 Correct 6 ms 8536 KB Output is correct
12 Correct 8 ms 8532 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 5 ms 8548 KB Output is correct
15 Correct 6 ms 8404 KB Output is correct
16 Correct 7 ms 8540 KB Output is correct
17 Correct 7 ms 8404 KB Output is correct
18 Correct 6 ms 8532 KB Output is correct
19 Correct 6 ms 8424 KB Output is correct
20 Correct 6 ms 8532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8404 KB Output is correct
2 Correct 7 ms 8404 KB Output is correct
3 Correct 6 ms 8420 KB Output is correct
4 Correct 6 ms 8532 KB Output is correct
5 Correct 5 ms 8276 KB Output is correct
6 Correct 5 ms 8148 KB Output is correct
7 Correct 6 ms 8532 KB Output is correct
8 Correct 6 ms 8532 KB Output is correct
9 Correct 7 ms 8404 KB Output is correct
10 Correct 6 ms 8532 KB Output is correct
11 Correct 6 ms 8536 KB Output is correct
12 Correct 8 ms 8532 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 5 ms 8548 KB Output is correct
15 Correct 6 ms 8404 KB Output is correct
16 Correct 7 ms 8540 KB Output is correct
17 Correct 7 ms 8404 KB Output is correct
18 Correct 6 ms 8532 KB Output is correct
19 Correct 6 ms 8424 KB Output is correct
20 Correct 6 ms 8532 KB Output is correct
21 Correct 7 ms 8440 KB Output is correct
22 Correct 6 ms 8404 KB Output is correct
23 Correct 6 ms 8404 KB Output is correct
24 Correct 8 ms 8504 KB Output is correct
25 Correct 5 ms 8220 KB Output is correct
26 Correct 6 ms 8148 KB Output is correct
27 Correct 6 ms 8404 KB Output is correct
28 Correct 6 ms 8404 KB Output is correct
29 Correct 6 ms 8404 KB Output is correct
30 Correct 7 ms 8432 KB Output is correct
31 Correct 8 ms 8496 KB Output is correct
32 Correct 7 ms 8456 KB Output is correct
33 Correct 6 ms 8416 KB Output is correct
34 Correct 7 ms 8416 KB Output is correct
35 Correct 8 ms 8416 KB Output is correct
36 Correct 8 ms 8404 KB Output is correct
37 Correct 6 ms 8404 KB Output is correct
38 Correct 8 ms 8404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 78 ms 18880 KB Output is correct
2 Correct 88 ms 18952 KB Output is correct
3 Correct 80 ms 18628 KB Output is correct
4 Correct 85 ms 18652 KB Output is correct
5 Correct 83 ms 18900 KB Output is correct
6 Correct 85 ms 18944 KB Output is correct
7 Correct 25 ms 10540 KB Output is correct
8 Correct 28 ms 10648 KB Output is correct
9 Correct 81 ms 18900 KB Output is correct
10 Correct 83 ms 18772 KB Output is correct
11 Correct 79 ms 18868 KB Output is correct
12 Correct 88 ms 18740 KB Output is correct
13 Correct 73 ms 16816 KB Output is correct
14 Correct 87 ms 19772 KB Output is correct
15 Correct 81 ms 16736 KB Output is correct
16 Correct 88 ms 19348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 410 ms 48240 KB Output is correct
2 Correct 333 ms 42056 KB Output is correct
3 Correct 414 ms 52496 KB Output is correct
4 Correct 417 ms 49660 KB Output is correct
5 Correct 311 ms 42348 KB Output is correct
6 Correct 512 ms 54096 KB Output is correct
7 Correct 115 ms 19400 KB Output is correct
8 Correct 131 ms 19392 KB Output is correct
9 Correct 514 ms 55940 KB Output is correct
10 Correct 466 ms 55968 KB Output is correct
11 Correct 438 ms 53772 KB Output is correct
12 Correct 433 ms 52540 KB Output is correct
13 Correct 431 ms 53720 KB Output is correct
14 Correct 445 ms 52636 KB Output is correct
15 Correct 449 ms 52616 KB Output is correct
16 Correct 440 ms 52732 KB Output is correct
17 Correct 480 ms 52600 KB Output is correct
18 Correct 434 ms 53212 KB Output is correct
19 Correct 451 ms 52692 KB Output is correct
20 Correct 427 ms 53200 KB Output is correct
21 Correct 508 ms 52488 KB Output is correct
22 Correct 472 ms 52460 KB Output is correct
23 Correct 424 ms 52564 KB Output is correct
24 Correct 454 ms 52472 KB Output is correct
25 Correct 316 ms 44940 KB Output is correct
26 Correct 323 ms 52448 KB Output is correct
27 Correct 397 ms 55048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8404 KB Output is correct
2 Correct 7 ms 8404 KB Output is correct
3 Correct 6 ms 8420 KB Output is correct
4 Correct 6 ms 8532 KB Output is correct
5 Correct 5 ms 8276 KB Output is correct
6 Correct 5 ms 8148 KB Output is correct
7 Correct 6 ms 8532 KB Output is correct
8 Correct 6 ms 8532 KB Output is correct
9 Correct 7 ms 8404 KB Output is correct
10 Correct 6 ms 8532 KB Output is correct
11 Correct 6 ms 8536 KB Output is correct
12 Correct 8 ms 8532 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 5 ms 8548 KB Output is correct
15 Correct 6 ms 8404 KB Output is correct
16 Correct 7 ms 8540 KB Output is correct
17 Correct 7 ms 8404 KB Output is correct
18 Correct 6 ms 8532 KB Output is correct
19 Correct 6 ms 8424 KB Output is correct
20 Correct 6 ms 8532 KB Output is correct
21 Correct 78 ms 18880 KB Output is correct
22 Correct 88 ms 18952 KB Output is correct
23 Correct 80 ms 18628 KB Output is correct
24 Correct 85 ms 18652 KB Output is correct
25 Correct 83 ms 18900 KB Output is correct
26 Correct 85 ms 18944 KB Output is correct
27 Correct 25 ms 10540 KB Output is correct
28 Correct 28 ms 10648 KB Output is correct
29 Correct 81 ms 18900 KB Output is correct
30 Correct 83 ms 18772 KB Output is correct
31 Correct 79 ms 18868 KB Output is correct
32 Correct 88 ms 18740 KB Output is correct
33 Correct 73 ms 16816 KB Output is correct
34 Correct 87 ms 19772 KB Output is correct
35 Correct 81 ms 16736 KB Output is correct
36 Correct 88 ms 19348 KB Output is correct
37 Correct 80 ms 18216 KB Output is correct
38 Correct 72 ms 18108 KB Output is correct
39 Correct 27 ms 10208 KB Output is correct
40 Correct 34 ms 10464 KB Output is correct
41 Correct 85 ms 19560 KB Output is correct
42 Correct 84 ms 19244 KB Output is correct
43 Correct 89 ms 19224 KB Output is correct
44 Correct 92 ms 19360 KB Output is correct
45 Correct 87 ms 19300 KB Output is correct
46 Correct 93 ms 19180 KB Output is correct
47 Correct 44 ms 19096 KB Output is correct
48 Correct 73 ms 19136 KB Output is correct
49 Correct 67 ms 15844 KB Output is correct
50 Correct 85 ms 18656 KB Output is correct
51 Correct 103 ms 19188 KB Output is correct
52 Correct 111 ms 19160 KB Output is correct
53 Correct 69 ms 17516 KB Output is correct
54 Correct 94 ms 19444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 19952 KB Output is correct
2 Correct 96 ms 17760 KB Output is correct
3 Correct 94 ms 19188 KB Output is correct
4 Correct 67 ms 17772 KB Output is correct
5 Correct 84 ms 18388 KB Output is correct
6 Correct 92 ms 19184 KB Output is correct
7 Correct 39 ms 10644 KB Output is correct
8 Correct 40 ms 10516 KB Output is correct
9 Correct 59 ms 19092 KB Output is correct
10 Correct 61 ms 17308 KB Output is correct
11 Correct 87 ms 19136 KB Output is correct
12 Correct 84 ms 19188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8404 KB Output is correct
2 Correct 7 ms 8404 KB Output is correct
3 Correct 6 ms 8420 KB Output is correct
4 Correct 6 ms 8532 KB Output is correct
5 Correct 5 ms 8276 KB Output is correct
6 Correct 5 ms 8148 KB Output is correct
7 Correct 6 ms 8532 KB Output is correct
8 Correct 6 ms 8532 KB Output is correct
9 Correct 7 ms 8404 KB Output is correct
10 Correct 6 ms 8532 KB Output is correct
11 Correct 6 ms 8536 KB Output is correct
12 Correct 8 ms 8532 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 5 ms 8548 KB Output is correct
15 Correct 6 ms 8404 KB Output is correct
16 Correct 7 ms 8540 KB Output is correct
17 Correct 7 ms 8404 KB Output is correct
18 Correct 6 ms 8532 KB Output is correct
19 Correct 6 ms 8424 KB Output is correct
20 Correct 6 ms 8532 KB Output is correct
21 Correct 7 ms 8440 KB Output is correct
22 Correct 6 ms 8404 KB Output is correct
23 Correct 6 ms 8404 KB Output is correct
24 Correct 8 ms 8504 KB Output is correct
25 Correct 5 ms 8220 KB Output is correct
26 Correct 6 ms 8148 KB Output is correct
27 Correct 6 ms 8404 KB Output is correct
28 Correct 6 ms 8404 KB Output is correct
29 Correct 6 ms 8404 KB Output is correct
30 Correct 7 ms 8432 KB Output is correct
31 Correct 8 ms 8496 KB Output is correct
32 Correct 7 ms 8456 KB Output is correct
33 Correct 6 ms 8416 KB Output is correct
34 Correct 7 ms 8416 KB Output is correct
35 Correct 8 ms 8416 KB Output is correct
36 Correct 8 ms 8404 KB Output is correct
37 Correct 6 ms 8404 KB Output is correct
38 Correct 8 ms 8404 KB Output is correct
39 Correct 78 ms 18880 KB Output is correct
40 Correct 88 ms 18952 KB Output is correct
41 Correct 80 ms 18628 KB Output is correct
42 Correct 85 ms 18652 KB Output is correct
43 Correct 83 ms 18900 KB Output is correct
44 Correct 85 ms 18944 KB Output is correct
45 Correct 25 ms 10540 KB Output is correct
46 Correct 28 ms 10648 KB Output is correct
47 Correct 81 ms 18900 KB Output is correct
48 Correct 83 ms 18772 KB Output is correct
49 Correct 79 ms 18868 KB Output is correct
50 Correct 88 ms 18740 KB Output is correct
51 Correct 73 ms 16816 KB Output is correct
52 Correct 87 ms 19772 KB Output is correct
53 Correct 81 ms 16736 KB Output is correct
54 Correct 88 ms 19348 KB Output is correct
55 Correct 80 ms 18216 KB Output is correct
56 Correct 72 ms 18108 KB Output is correct
57 Correct 27 ms 10208 KB Output is correct
58 Correct 34 ms 10464 KB Output is correct
59 Correct 85 ms 19560 KB Output is correct
60 Correct 84 ms 19244 KB Output is correct
61 Correct 89 ms 19224 KB Output is correct
62 Correct 92 ms 19360 KB Output is correct
63 Correct 87 ms 19300 KB Output is correct
64 Correct 93 ms 19180 KB Output is correct
65 Correct 44 ms 19096 KB Output is correct
66 Correct 73 ms 19136 KB Output is correct
67 Correct 67 ms 15844 KB Output is correct
68 Correct 85 ms 18656 KB Output is correct
69 Correct 103 ms 19188 KB Output is correct
70 Correct 111 ms 19160 KB Output is correct
71 Correct 69 ms 17516 KB Output is correct
72 Correct 94 ms 19444 KB Output is correct
73 Correct 83 ms 19952 KB Output is correct
74 Correct 96 ms 17760 KB Output is correct
75 Correct 94 ms 19188 KB Output is correct
76 Correct 67 ms 17772 KB Output is correct
77 Correct 84 ms 18388 KB Output is correct
78 Correct 92 ms 19184 KB Output is correct
79 Correct 39 ms 10644 KB Output is correct
80 Correct 40 ms 10516 KB Output is correct
81 Correct 59 ms 19092 KB Output is correct
82 Correct 61 ms 17308 KB Output is correct
83 Correct 87 ms 19136 KB Output is correct
84 Correct 84 ms 19188 KB Output is correct
85 Correct 81 ms 16296 KB Output is correct
86 Correct 90 ms 18232 KB Output is correct
87 Correct 101 ms 17712 KB Output is correct
88 Correct 96 ms 18460 KB Output is correct
89 Correct 60 ms 16028 KB Output is correct
90 Correct 96 ms 18204 KB Output is correct
91 Correct 74 ms 15172 KB Output is correct
92 Correct 70 ms 15116 KB Output is correct
93 Correct 90 ms 18128 KB Output is correct
94 Correct 85 ms 18288 KB Output is correct
95 Correct 83 ms 17304 KB Output is correct
96 Correct 86 ms 18140 KB Output is correct
97 Correct 99 ms 18096 KB Output is correct
98 Correct 75 ms 15484 KB Output is correct
99 Correct 46 ms 18176 KB Output is correct
100 Correct 65 ms 16748 KB Output is correct
101 Correct 76 ms 18152 KB Output is correct
102 Correct 83 ms 18824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8404 KB Output is correct
2 Correct 7 ms 8404 KB Output is correct
3 Correct 6 ms 8420 KB Output is correct
4 Correct 6 ms 8532 KB Output is correct
5 Correct 5 ms 8276 KB Output is correct
6 Correct 5 ms 8148 KB Output is correct
7 Correct 6 ms 8532 KB Output is correct
8 Correct 6 ms 8532 KB Output is correct
9 Correct 7 ms 8404 KB Output is correct
10 Correct 6 ms 8532 KB Output is correct
11 Correct 6 ms 8536 KB Output is correct
12 Correct 8 ms 8532 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 5 ms 8548 KB Output is correct
15 Correct 6 ms 8404 KB Output is correct
16 Correct 7 ms 8540 KB Output is correct
17 Correct 7 ms 8404 KB Output is correct
18 Correct 6 ms 8532 KB Output is correct
19 Correct 6 ms 8424 KB Output is correct
20 Correct 6 ms 8532 KB Output is correct
21 Correct 7 ms 8440 KB Output is correct
22 Correct 6 ms 8404 KB Output is correct
23 Correct 6 ms 8404 KB Output is correct
24 Correct 8 ms 8504 KB Output is correct
25 Correct 5 ms 8220 KB Output is correct
26 Correct 6 ms 8148 KB Output is correct
27 Correct 6 ms 8404 KB Output is correct
28 Correct 6 ms 8404 KB Output is correct
29 Correct 6 ms 8404 KB Output is correct
30 Correct 7 ms 8432 KB Output is correct
31 Correct 8 ms 8496 KB Output is correct
32 Correct 7 ms 8456 KB Output is correct
33 Correct 6 ms 8416 KB Output is correct
34 Correct 7 ms 8416 KB Output is correct
35 Correct 8 ms 8416 KB Output is correct
36 Correct 8 ms 8404 KB Output is correct
37 Correct 6 ms 8404 KB Output is correct
38 Correct 8 ms 8404 KB Output is correct
39 Correct 78 ms 18880 KB Output is correct
40 Correct 88 ms 18952 KB Output is correct
41 Correct 80 ms 18628 KB Output is correct
42 Correct 85 ms 18652 KB Output is correct
43 Correct 83 ms 18900 KB Output is correct
44 Correct 85 ms 18944 KB Output is correct
45 Correct 25 ms 10540 KB Output is correct
46 Correct 28 ms 10648 KB Output is correct
47 Correct 81 ms 18900 KB Output is correct
48 Correct 83 ms 18772 KB Output is correct
49 Correct 79 ms 18868 KB Output is correct
50 Correct 88 ms 18740 KB Output is correct
51 Correct 73 ms 16816 KB Output is correct
52 Correct 87 ms 19772 KB Output is correct
53 Correct 81 ms 16736 KB Output is correct
54 Correct 88 ms 19348 KB Output is correct
55 Correct 410 ms 48240 KB Output is correct
56 Correct 333 ms 42056 KB Output is correct
57 Correct 414 ms 52496 KB Output is correct
58 Correct 417 ms 49660 KB Output is correct
59 Correct 311 ms 42348 KB Output is correct
60 Correct 512 ms 54096 KB Output is correct
61 Correct 115 ms 19400 KB Output is correct
62 Correct 131 ms 19392 KB Output is correct
63 Correct 514 ms 55940 KB Output is correct
64 Correct 466 ms 55968 KB Output is correct
65 Correct 438 ms 53772 KB Output is correct
66 Correct 433 ms 52540 KB Output is correct
67 Correct 431 ms 53720 KB Output is correct
68 Correct 445 ms 52636 KB Output is correct
69 Correct 449 ms 52616 KB Output is correct
70 Correct 440 ms 52732 KB Output is correct
71 Correct 480 ms 52600 KB Output is correct
72 Correct 434 ms 53212 KB Output is correct
73 Correct 451 ms 52692 KB Output is correct
74 Correct 427 ms 53200 KB Output is correct
75 Correct 508 ms 52488 KB Output is correct
76 Correct 472 ms 52460 KB Output is correct
77 Correct 424 ms 52564 KB Output is correct
78 Correct 454 ms 52472 KB Output is correct
79 Correct 316 ms 44940 KB Output is correct
80 Correct 323 ms 52448 KB Output is correct
81 Correct 397 ms 55048 KB Output is correct
82 Correct 80 ms 18216 KB Output is correct
83 Correct 72 ms 18108 KB Output is correct
84 Correct 27 ms 10208 KB Output is correct
85 Correct 34 ms 10464 KB Output is correct
86 Correct 85 ms 19560 KB Output is correct
87 Correct 84 ms 19244 KB Output is correct
88 Correct 89 ms 19224 KB Output is correct
89 Correct 92 ms 19360 KB Output is correct
90 Correct 87 ms 19300 KB Output is correct
91 Correct 93 ms 19180 KB Output is correct
92 Correct 44 ms 19096 KB Output is correct
93 Correct 73 ms 19136 KB Output is correct
94 Correct 67 ms 15844 KB Output is correct
95 Correct 85 ms 18656 KB Output is correct
96 Correct 103 ms 19188 KB Output is correct
97 Correct 111 ms 19160 KB Output is correct
98 Correct 69 ms 17516 KB Output is correct
99 Correct 94 ms 19444 KB Output is correct
100 Correct 83 ms 19952 KB Output is correct
101 Correct 96 ms 17760 KB Output is correct
102 Correct 94 ms 19188 KB Output is correct
103 Correct 67 ms 17772 KB Output is correct
104 Correct 84 ms 18388 KB Output is correct
105 Correct 92 ms 19184 KB Output is correct
106 Correct 39 ms 10644 KB Output is correct
107 Correct 40 ms 10516 KB Output is correct
108 Correct 59 ms 19092 KB Output is correct
109 Correct 61 ms 17308 KB Output is correct
110 Correct 87 ms 19136 KB Output is correct
111 Correct 84 ms 19188 KB Output is correct
112 Correct 81 ms 16296 KB Output is correct
113 Correct 90 ms 18232 KB Output is correct
114 Correct 101 ms 17712 KB Output is correct
115 Correct 96 ms 18460 KB Output is correct
116 Correct 60 ms 16028 KB Output is correct
117 Correct 96 ms 18204 KB Output is correct
118 Correct 74 ms 15172 KB Output is correct
119 Correct 70 ms 15116 KB Output is correct
120 Correct 90 ms 18128 KB Output is correct
121 Correct 85 ms 18288 KB Output is correct
122 Correct 83 ms 17304 KB Output is correct
123 Correct 86 ms 18140 KB Output is correct
124 Correct 99 ms 18096 KB Output is correct
125 Correct 75 ms 15484 KB Output is correct
126 Correct 46 ms 18176 KB Output is correct
127 Correct 65 ms 16748 KB Output is correct
128 Correct 76 ms 18152 KB Output is correct
129 Correct 83 ms 18824 KB Output is correct
130 Correct 407 ms 52352 KB Output is correct
131 Correct 312 ms 41492 KB Output is correct
132 Correct 457 ms 53052 KB Output is correct
133 Correct 426 ms 52988 KB Output is correct
134 Correct 381 ms 51368 KB Output is correct
135 Correct 448 ms 54848 KB Output is correct
136 Correct 479 ms 56824 KB Output is correct
137 Correct 487 ms 56860 KB Output is correct
138 Correct 453 ms 54424 KB Output is correct
139 Correct 426 ms 53376 KB Output is correct
140 Correct 438 ms 54332 KB Output is correct
141 Correct 442 ms 53288 KB Output is correct
142 Correct 428 ms 53384 KB Output is correct
143 Correct 434 ms 53188 KB Output is correct
144 Correct 450 ms 53780 KB Output is correct
145 Correct 428 ms 53156 KB Output is correct
146 Correct 444 ms 53772 KB Output is correct
147 Correct 512 ms 53116 KB Output is correct
148 Correct 468 ms 53124 KB Output is correct
149 Correct 439 ms 53080 KB Output is correct
150 Correct 170 ms 52540 KB Output is correct
151 Correct 317 ms 52892 KB Output is correct
152 Correct 335 ms 52984 KB Output is correct
153 Correct 370 ms 55976 KB Output is correct