답안 #499317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499317 2021-12-28T02:36:03 Z hollwo_pelw 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
460 ms 66796 KB
/*
// is short or still long ???
hollwo_pelw's template(short)
// Note : -Dhollwo_pelw_local
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>

using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;

void FAST_IO(string filein = "", string fileout = "", string fileerr = ""){
	if (fopen(filein.c_str(), "r")){
		freopen(filein.c_str(), "r", stdin);
		freopen(fileout.c_str(), "w", stdout);
#ifdef hollwo_pelw_local
		freopen(fileerr.c_str(), "w", stderr);
#endif
	}
	cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
}

void Hollwo_Pelw();

signed main(){
#ifdef hollwo_pelw_local
	FAST_IO("input.inp", "output.out", "error.err");
	auto start = chrono::steady_clock::now();
#else
	FAST_IO("hollwo_pelw.inp", "hollwo_pelw.out");
#endif
	int testcases = 1;
	// cin >> testcases;
	for (int test = 1; test <= testcases; test++){
		// cout << "Case #" << test << ": ";
		Hollwo_Pelw();
	}
#ifdef hollwo_pelw_local
	auto end = chrono::steady_clock::now();
	cout << "\nExcution time : " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
#endif
	return 0;
}

const int N = 2.5e5 + 5;

#define int long long

vector<pair<int, int>> supd[N], fupd[N], qry[N];
int n, m, q, color[N], res[N];

// segment tree
struct node_t {
	int mx, sum;
	node_t (int _mx = 0, int _sum = 0)
		: mx(_mx), sum(_sum) {}
	friend node_t merge(const node_t &a, const node_t &b) {
		return node_t(max(a.mx + b.sum, b.mx), a.sum + b.sum);
	}
} st[N << 2];

#define tm (tl + tr >> 1)
#define left id << 1, tl, tm
#define right id << 1 | 1, tm + 1, tr

void update_st(int p, int v, int id = 1, int tl = 1, int tr = q) {
	if (tl == tr)
		return st[id] = node_t(max(0ll, v), v), (void) 0;
	(p > tm ? update_st(p, v, right)
			: update_st(p, v, left));
	st[id] = merge(st[id << 1], st[id << 1 | 1]);
}

node_t query_st(int l, int r, int id = 1, int tl = 1, int tr = q) {
	if (l > tr || tl > r) return node_t();
	if (l <= tl && tr <= r) return st[id];
	return merge(query_st(l, r, left), query_st(l, r, right));
}

// fenwick tree
int bit[N];
inline void update_fw(int p, int v) {
	for (; p < N; p += p & -p)
		bit[p] += v;
}

inline int query_fw(int p) {
	int r = 0;
	for (; p > 0; p -= p & -p)
		r += bit[p];
	return r;
}

inline int find_kth(int val) {
	int p = 0;
	for (int i = 17; ~i; i--) {
		if (p + (1 << i) < N && bit[p + (1 << i)] < val) {
			p += 1 << i;
			val -= bit[p];
		}
	}
	return p + 1;
}

void Hollwo_Pelw() {
	cin >> n >> m >> q;

	for (int i = 1, t, l, r, k; i <= q; i++) {
		cin >> t;
		if (t == 1) {
			cin >> l >> r >> color[i] >> k;
			supd[l    ].emplace_back(i, +k);
			supd[r + 1].emplace_back(i,  0);
			fupd[l    ].emplace_back(i, +k);
			fupd[r + 1].emplace_back(i, -k);
		}
		if (t == 2) {
			cin >> l >> r >> k;
			supd[l    ].emplace_back(i, -k);
			supd[r + 1].emplace_back(i,  0);
		}
		if (t == 3) {
			cin >> l >> k;
			qry[l].emplace_back(i, k);
		}
	}

	memset(res, -1, sizeof res);

	for (int i = 1; i <= n; i++) {
		for (auto [p, v] : supd[i])
			update_st(p, v);
		for (auto [p, v] : fupd[i])
			update_fw(p, v);
		for (auto [p, v] : qry[i]) {
			auto cur_state = query_st(1, p);

			if (v > cur_state.mx) {
				res[p] = 0;
			} else {
				v = query_fw(p) - (cur_state.mx - v);
				res[p] = color[find_kth(v)];
			}
		}
	}

	for (int i = 1; i <= q; i++)
		if (~res[i]) cout << res[i] << '\n';
}

Compilation message

foodcourt.cpp: In function 'void update_st(long long int, long long int, long long int, long long int, long long int)':
foodcourt.cpp:66:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   66 | #define tm (tl + tr >> 1)
      |             ~~~^~~~
foodcourt.cpp:73:7: note: in expansion of macro 'tm'
   73 |  (p > tm ? update_st(p, v, right)
      |       ^~
foodcourt.cpp:66:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   66 | #define tm (tl + tr >> 1)
      |             ~~~^~~~
foodcourt.cpp:68:28: note: in expansion of macro 'tm'
   68 | #define right id << 1 | 1, tm + 1, tr
      |                            ^~
foodcourt.cpp:73:28: note: in expansion of macro 'right'
   73 |  (p > tm ? update_st(p, v, right)
      |                            ^~~~~
foodcourt.cpp:66:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   66 | #define tm (tl + tr >> 1)
      |             ~~~^~~~
foodcourt.cpp:67:27: note: in expansion of macro 'tm'
   67 | #define left id << 1, tl, tm
      |                           ^~
foodcourt.cpp:74:22: note: in expansion of macro 'left'
   74 |    : update_st(p, v, left));
      |                      ^~~~
foodcourt.cpp: In function 'node_t query_st(long long int, long long int, long long int, long long int, long long int)':
foodcourt.cpp:66:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   66 | #define tm (tl + tr >> 1)
      |             ~~~^~~~
foodcourt.cpp:67:27: note: in expansion of macro 'tm'
   67 | #define left id << 1, tl, tm
      |                           ^~
foodcourt.cpp:81:30: note: in expansion of macro 'left'
   81 |  return merge(query_st(l, r, left), query_st(l, r, right));
      |                              ^~~~
foodcourt.cpp:66:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   66 | #define tm (tl + tr >> 1)
      |             ~~~^~~~
foodcourt.cpp:68:28: note: in expansion of macro 'tm'
   68 | #define right id << 1 | 1, tm + 1, tr
      |                            ^~
foodcourt.cpp:81:52: note: in expansion of macro 'right'
   81 |  return merge(query_st(l, r, left), query_st(l, r, right));
      |                                                    ^~~~~
foodcourt.cpp: In function 'void FAST_IO(std::string, std::string, std::string)':
foodcourt.cpp:18:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   freopen(filein.c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:19:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   freopen(fileout.c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35660 KB Output is correct
2 Correct 16 ms 35660 KB Output is correct
3 Correct 15 ms 35660 KB Output is correct
4 Correct 16 ms 35764 KB Output is correct
5 Correct 15 ms 35660 KB Output is correct
6 Correct 16 ms 35612 KB Output is correct
7 Correct 17 ms 35688 KB Output is correct
8 Correct 17 ms 35632 KB Output is correct
9 Correct 16 ms 35660 KB Output is correct
10 Correct 16 ms 35748 KB Output is correct
11 Correct 17 ms 35660 KB Output is correct
12 Correct 16 ms 35744 KB Output is correct
13 Correct 16 ms 35752 KB Output is correct
14 Correct 16 ms 35780 KB Output is correct
15 Correct 16 ms 35692 KB Output is correct
16 Correct 16 ms 35660 KB Output is correct
17 Correct 16 ms 35692 KB Output is correct
18 Correct 17 ms 35660 KB Output is correct
19 Correct 17 ms 35664 KB Output is correct
20 Correct 16 ms 35792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35660 KB Output is correct
2 Correct 16 ms 35660 KB Output is correct
3 Correct 15 ms 35660 KB Output is correct
4 Correct 16 ms 35764 KB Output is correct
5 Correct 15 ms 35660 KB Output is correct
6 Correct 16 ms 35612 KB Output is correct
7 Correct 17 ms 35688 KB Output is correct
8 Correct 17 ms 35632 KB Output is correct
9 Correct 16 ms 35660 KB Output is correct
10 Correct 16 ms 35748 KB Output is correct
11 Correct 17 ms 35660 KB Output is correct
12 Correct 16 ms 35744 KB Output is correct
13 Correct 16 ms 35752 KB Output is correct
14 Correct 16 ms 35780 KB Output is correct
15 Correct 16 ms 35692 KB Output is correct
16 Correct 16 ms 35660 KB Output is correct
17 Correct 16 ms 35692 KB Output is correct
18 Correct 17 ms 35660 KB Output is correct
19 Correct 17 ms 35664 KB Output is correct
20 Correct 16 ms 35792 KB Output is correct
21 Correct 16 ms 35636 KB Output is correct
22 Correct 17 ms 35732 KB Output is correct
23 Correct 16 ms 35660 KB Output is correct
24 Correct 17 ms 35668 KB Output is correct
25 Correct 16 ms 35716 KB Output is correct
26 Correct 16 ms 35660 KB Output is correct
27 Correct 17 ms 35728 KB Output is correct
28 Correct 17 ms 35724 KB Output is correct
29 Correct 16 ms 35736 KB Output is correct
30 Correct 17 ms 35660 KB Output is correct
31 Correct 18 ms 35752 KB Output is correct
32 Correct 18 ms 35724 KB Output is correct
33 Correct 16 ms 35660 KB Output is correct
34 Correct 16 ms 35628 KB Output is correct
35 Correct 16 ms 35616 KB Output is correct
36 Correct 15 ms 35660 KB Output is correct
37 Correct 16 ms 35628 KB Output is correct
38 Correct 16 ms 35800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 40644 KB Output is correct
2 Correct 80 ms 41240 KB Output is correct
3 Correct 74 ms 40576 KB Output is correct
4 Correct 79 ms 40572 KB Output is correct
5 Correct 79 ms 41284 KB Output is correct
6 Correct 83 ms 41184 KB Output is correct
7 Correct 39 ms 39044 KB Output is correct
8 Correct 41 ms 39328 KB Output is correct
9 Correct 77 ms 40500 KB Output is correct
10 Correct 80 ms 40872 KB Output is correct
11 Correct 80 ms 40784 KB Output is correct
12 Correct 77 ms 40828 KB Output is correct
13 Correct 68 ms 40612 KB Output is correct
14 Correct 77 ms 41268 KB Output is correct
15 Correct 92 ms 42488 KB Output is correct
16 Correct 90 ms 42464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 364 ms 53572 KB Output is correct
2 Correct 283 ms 49984 KB Output is correct
3 Correct 402 ms 55184 KB Output is correct
4 Correct 299 ms 56276 KB Output is correct
5 Correct 297 ms 56440 KB Output is correct
6 Correct 416 ms 63764 KB Output is correct
7 Correct 129 ms 54688 KB Output is correct
8 Correct 141 ms 55312 KB Output is correct
9 Correct 398 ms 62488 KB Output is correct
10 Correct 401 ms 62476 KB Output is correct
11 Correct 392 ms 60228 KB Output is correct
12 Correct 402 ms 62296 KB Output is correct
13 Correct 388 ms 60396 KB Output is correct
14 Correct 403 ms 62256 KB Output is correct
15 Correct 408 ms 61948 KB Output is correct
16 Correct 422 ms 62084 KB Output is correct
17 Correct 420 ms 62128 KB Output is correct
18 Correct 416 ms 61124 KB Output is correct
19 Correct 420 ms 62172 KB Output is correct
20 Correct 423 ms 61296 KB Output is correct
21 Correct 405 ms 62108 KB Output is correct
22 Correct 451 ms 62092 KB Output is correct
23 Correct 416 ms 62020 KB Output is correct
24 Correct 420 ms 62080 KB Output is correct
25 Correct 285 ms 60508 KB Output is correct
26 Correct 286 ms 61128 KB Output is correct
27 Correct 316 ms 65864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35660 KB Output is correct
2 Correct 16 ms 35660 KB Output is correct
3 Correct 15 ms 35660 KB Output is correct
4 Correct 16 ms 35764 KB Output is correct
5 Correct 15 ms 35660 KB Output is correct
6 Correct 16 ms 35612 KB Output is correct
7 Correct 17 ms 35688 KB Output is correct
8 Correct 17 ms 35632 KB Output is correct
9 Correct 16 ms 35660 KB Output is correct
10 Correct 16 ms 35748 KB Output is correct
11 Correct 17 ms 35660 KB Output is correct
12 Correct 16 ms 35744 KB Output is correct
13 Correct 16 ms 35752 KB Output is correct
14 Correct 16 ms 35780 KB Output is correct
15 Correct 16 ms 35692 KB Output is correct
16 Correct 16 ms 35660 KB Output is correct
17 Correct 16 ms 35692 KB Output is correct
18 Correct 17 ms 35660 KB Output is correct
19 Correct 17 ms 35664 KB Output is correct
20 Correct 16 ms 35792 KB Output is correct
21 Correct 74 ms 40644 KB Output is correct
22 Correct 80 ms 41240 KB Output is correct
23 Correct 74 ms 40576 KB Output is correct
24 Correct 79 ms 40572 KB Output is correct
25 Correct 79 ms 41284 KB Output is correct
26 Correct 83 ms 41184 KB Output is correct
27 Correct 39 ms 39044 KB Output is correct
28 Correct 41 ms 39328 KB Output is correct
29 Correct 77 ms 40500 KB Output is correct
30 Correct 80 ms 40872 KB Output is correct
31 Correct 80 ms 40784 KB Output is correct
32 Correct 77 ms 40828 KB Output is correct
33 Correct 68 ms 40612 KB Output is correct
34 Correct 77 ms 41268 KB Output is correct
35 Correct 92 ms 42488 KB Output is correct
36 Correct 90 ms 42464 KB Output is correct
37 Correct 74 ms 40112 KB Output is correct
38 Correct 73 ms 40132 KB Output is correct
39 Correct 38 ms 38756 KB Output is correct
40 Correct 42 ms 39400 KB Output is correct
41 Correct 79 ms 40340 KB Output is correct
42 Correct 80 ms 40844 KB Output is correct
43 Correct 88 ms 40852 KB Output is correct
44 Correct 85 ms 40596 KB Output is correct
45 Correct 90 ms 40856 KB Output is correct
46 Correct 87 ms 40852 KB Output is correct
47 Correct 48 ms 39664 KB Output is correct
48 Correct 65 ms 40720 KB Output is correct
49 Correct 63 ms 39392 KB Output is correct
50 Correct 74 ms 40172 KB Output is correct
51 Correct 83 ms 41052 KB Output is correct
52 Correct 96 ms 41028 KB Output is correct
53 Correct 70 ms 40980 KB Output is correct
54 Correct 88 ms 42412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 78 ms 40468 KB Output is correct
2 Correct 89 ms 40872 KB Output is correct
3 Correct 86 ms 41104 KB Output is correct
4 Correct 65 ms 39496 KB Output is correct
5 Correct 75 ms 40260 KB Output is correct
6 Correct 87 ms 41048 KB Output is correct
7 Correct 44 ms 39060 KB Output is correct
8 Correct 43 ms 38740 KB Output is correct
9 Correct 56 ms 39680 KB Output is correct
10 Correct 53 ms 39224 KB Output is correct
11 Correct 74 ms 40420 KB Output is correct
12 Correct 69 ms 40388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35660 KB Output is correct
2 Correct 16 ms 35660 KB Output is correct
3 Correct 15 ms 35660 KB Output is correct
4 Correct 16 ms 35764 KB Output is correct
5 Correct 15 ms 35660 KB Output is correct
6 Correct 16 ms 35612 KB Output is correct
7 Correct 17 ms 35688 KB Output is correct
8 Correct 17 ms 35632 KB Output is correct
9 Correct 16 ms 35660 KB Output is correct
10 Correct 16 ms 35748 KB Output is correct
11 Correct 17 ms 35660 KB Output is correct
12 Correct 16 ms 35744 KB Output is correct
13 Correct 16 ms 35752 KB Output is correct
14 Correct 16 ms 35780 KB Output is correct
15 Correct 16 ms 35692 KB Output is correct
16 Correct 16 ms 35660 KB Output is correct
17 Correct 16 ms 35692 KB Output is correct
18 Correct 17 ms 35660 KB Output is correct
19 Correct 17 ms 35664 KB Output is correct
20 Correct 16 ms 35792 KB Output is correct
21 Correct 16 ms 35636 KB Output is correct
22 Correct 17 ms 35732 KB Output is correct
23 Correct 16 ms 35660 KB Output is correct
24 Correct 17 ms 35668 KB Output is correct
25 Correct 16 ms 35716 KB Output is correct
26 Correct 16 ms 35660 KB Output is correct
27 Correct 17 ms 35728 KB Output is correct
28 Correct 17 ms 35724 KB Output is correct
29 Correct 16 ms 35736 KB Output is correct
30 Correct 17 ms 35660 KB Output is correct
31 Correct 18 ms 35752 KB Output is correct
32 Correct 18 ms 35724 KB Output is correct
33 Correct 16 ms 35660 KB Output is correct
34 Correct 16 ms 35628 KB Output is correct
35 Correct 16 ms 35616 KB Output is correct
36 Correct 15 ms 35660 KB Output is correct
37 Correct 16 ms 35628 KB Output is correct
38 Correct 16 ms 35800 KB Output is correct
39 Correct 74 ms 40644 KB Output is correct
40 Correct 80 ms 41240 KB Output is correct
41 Correct 74 ms 40576 KB Output is correct
42 Correct 79 ms 40572 KB Output is correct
43 Correct 79 ms 41284 KB Output is correct
44 Correct 83 ms 41184 KB Output is correct
45 Correct 39 ms 39044 KB Output is correct
46 Correct 41 ms 39328 KB Output is correct
47 Correct 77 ms 40500 KB Output is correct
48 Correct 80 ms 40872 KB Output is correct
49 Correct 80 ms 40784 KB Output is correct
50 Correct 77 ms 40828 KB Output is correct
51 Correct 68 ms 40612 KB Output is correct
52 Correct 77 ms 41268 KB Output is correct
53 Correct 92 ms 42488 KB Output is correct
54 Correct 90 ms 42464 KB Output is correct
55 Correct 74 ms 40112 KB Output is correct
56 Correct 73 ms 40132 KB Output is correct
57 Correct 38 ms 38756 KB Output is correct
58 Correct 42 ms 39400 KB Output is correct
59 Correct 79 ms 40340 KB Output is correct
60 Correct 80 ms 40844 KB Output is correct
61 Correct 88 ms 40852 KB Output is correct
62 Correct 85 ms 40596 KB Output is correct
63 Correct 90 ms 40856 KB Output is correct
64 Correct 87 ms 40852 KB Output is correct
65 Correct 48 ms 39664 KB Output is correct
66 Correct 65 ms 40720 KB Output is correct
67 Correct 63 ms 39392 KB Output is correct
68 Correct 74 ms 40172 KB Output is correct
69 Correct 83 ms 41052 KB Output is correct
70 Correct 96 ms 41028 KB Output is correct
71 Correct 70 ms 40980 KB Output is correct
72 Correct 88 ms 42412 KB Output is correct
73 Correct 78 ms 40468 KB Output is correct
74 Correct 89 ms 40872 KB Output is correct
75 Correct 86 ms 41104 KB Output is correct
76 Correct 65 ms 39496 KB Output is correct
77 Correct 75 ms 40260 KB Output is correct
78 Correct 87 ms 41048 KB Output is correct
79 Correct 44 ms 39060 KB Output is correct
80 Correct 43 ms 38740 KB Output is correct
81 Correct 56 ms 39680 KB Output is correct
82 Correct 53 ms 39224 KB Output is correct
83 Correct 74 ms 40420 KB Output is correct
84 Correct 69 ms 40388 KB Output is correct
85 Correct 80 ms 40160 KB Output is correct
86 Correct 99 ms 40644 KB Output is correct
87 Correct 82 ms 40560 KB Output is correct
88 Correct 89 ms 41308 KB Output is correct
89 Correct 65 ms 38800 KB Output is correct
90 Correct 85 ms 40856 KB Output is correct
91 Correct 71 ms 39936 KB Output is correct
92 Correct 70 ms 39660 KB Output is correct
93 Correct 89 ms 40900 KB Output is correct
94 Correct 87 ms 40644 KB Output is correct
95 Correct 91 ms 40808 KB Output is correct
96 Correct 91 ms 40864 KB Output is correct
97 Correct 88 ms 40916 KB Output is correct
98 Correct 75 ms 40052 KB Output is correct
99 Correct 53 ms 39268 KB Output is correct
100 Correct 67 ms 39500 KB Output is correct
101 Correct 70 ms 40760 KB Output is correct
102 Correct 80 ms 41924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 35660 KB Output is correct
2 Correct 16 ms 35660 KB Output is correct
3 Correct 15 ms 35660 KB Output is correct
4 Correct 16 ms 35764 KB Output is correct
5 Correct 15 ms 35660 KB Output is correct
6 Correct 16 ms 35612 KB Output is correct
7 Correct 17 ms 35688 KB Output is correct
8 Correct 17 ms 35632 KB Output is correct
9 Correct 16 ms 35660 KB Output is correct
10 Correct 16 ms 35748 KB Output is correct
11 Correct 17 ms 35660 KB Output is correct
12 Correct 16 ms 35744 KB Output is correct
13 Correct 16 ms 35752 KB Output is correct
14 Correct 16 ms 35780 KB Output is correct
15 Correct 16 ms 35692 KB Output is correct
16 Correct 16 ms 35660 KB Output is correct
17 Correct 16 ms 35692 KB Output is correct
18 Correct 17 ms 35660 KB Output is correct
19 Correct 17 ms 35664 KB Output is correct
20 Correct 16 ms 35792 KB Output is correct
21 Correct 16 ms 35636 KB Output is correct
22 Correct 17 ms 35732 KB Output is correct
23 Correct 16 ms 35660 KB Output is correct
24 Correct 17 ms 35668 KB Output is correct
25 Correct 16 ms 35716 KB Output is correct
26 Correct 16 ms 35660 KB Output is correct
27 Correct 17 ms 35728 KB Output is correct
28 Correct 17 ms 35724 KB Output is correct
29 Correct 16 ms 35736 KB Output is correct
30 Correct 17 ms 35660 KB Output is correct
31 Correct 18 ms 35752 KB Output is correct
32 Correct 18 ms 35724 KB Output is correct
33 Correct 16 ms 35660 KB Output is correct
34 Correct 16 ms 35628 KB Output is correct
35 Correct 16 ms 35616 KB Output is correct
36 Correct 15 ms 35660 KB Output is correct
37 Correct 16 ms 35628 KB Output is correct
38 Correct 16 ms 35800 KB Output is correct
39 Correct 74 ms 40644 KB Output is correct
40 Correct 80 ms 41240 KB Output is correct
41 Correct 74 ms 40576 KB Output is correct
42 Correct 79 ms 40572 KB Output is correct
43 Correct 79 ms 41284 KB Output is correct
44 Correct 83 ms 41184 KB Output is correct
45 Correct 39 ms 39044 KB Output is correct
46 Correct 41 ms 39328 KB Output is correct
47 Correct 77 ms 40500 KB Output is correct
48 Correct 80 ms 40872 KB Output is correct
49 Correct 80 ms 40784 KB Output is correct
50 Correct 77 ms 40828 KB Output is correct
51 Correct 68 ms 40612 KB Output is correct
52 Correct 77 ms 41268 KB Output is correct
53 Correct 92 ms 42488 KB Output is correct
54 Correct 90 ms 42464 KB Output is correct
55 Correct 364 ms 53572 KB Output is correct
56 Correct 283 ms 49984 KB Output is correct
57 Correct 402 ms 55184 KB Output is correct
58 Correct 299 ms 56276 KB Output is correct
59 Correct 297 ms 56440 KB Output is correct
60 Correct 416 ms 63764 KB Output is correct
61 Correct 129 ms 54688 KB Output is correct
62 Correct 141 ms 55312 KB Output is correct
63 Correct 398 ms 62488 KB Output is correct
64 Correct 401 ms 62476 KB Output is correct
65 Correct 392 ms 60228 KB Output is correct
66 Correct 402 ms 62296 KB Output is correct
67 Correct 388 ms 60396 KB Output is correct
68 Correct 403 ms 62256 KB Output is correct
69 Correct 408 ms 61948 KB Output is correct
70 Correct 422 ms 62084 KB Output is correct
71 Correct 420 ms 62128 KB Output is correct
72 Correct 416 ms 61124 KB Output is correct
73 Correct 420 ms 62172 KB Output is correct
74 Correct 423 ms 61296 KB Output is correct
75 Correct 405 ms 62108 KB Output is correct
76 Correct 451 ms 62092 KB Output is correct
77 Correct 416 ms 62020 KB Output is correct
78 Correct 420 ms 62080 KB Output is correct
79 Correct 285 ms 60508 KB Output is correct
80 Correct 286 ms 61128 KB Output is correct
81 Correct 316 ms 65864 KB Output is correct
82 Correct 74 ms 40112 KB Output is correct
83 Correct 73 ms 40132 KB Output is correct
84 Correct 38 ms 38756 KB Output is correct
85 Correct 42 ms 39400 KB Output is correct
86 Correct 79 ms 40340 KB Output is correct
87 Correct 80 ms 40844 KB Output is correct
88 Correct 88 ms 40852 KB Output is correct
89 Correct 85 ms 40596 KB Output is correct
90 Correct 90 ms 40856 KB Output is correct
91 Correct 87 ms 40852 KB Output is correct
92 Correct 48 ms 39664 KB Output is correct
93 Correct 65 ms 40720 KB Output is correct
94 Correct 63 ms 39392 KB Output is correct
95 Correct 74 ms 40172 KB Output is correct
96 Correct 83 ms 41052 KB Output is correct
97 Correct 96 ms 41028 KB Output is correct
98 Correct 70 ms 40980 KB Output is correct
99 Correct 88 ms 42412 KB Output is correct
100 Correct 78 ms 40468 KB Output is correct
101 Correct 89 ms 40872 KB Output is correct
102 Correct 86 ms 41104 KB Output is correct
103 Correct 65 ms 39496 KB Output is correct
104 Correct 75 ms 40260 KB Output is correct
105 Correct 87 ms 41048 KB Output is correct
106 Correct 44 ms 39060 KB Output is correct
107 Correct 43 ms 38740 KB Output is correct
108 Correct 56 ms 39680 KB Output is correct
109 Correct 53 ms 39224 KB Output is correct
110 Correct 74 ms 40420 KB Output is correct
111 Correct 69 ms 40388 KB Output is correct
112 Correct 80 ms 40160 KB Output is correct
113 Correct 99 ms 40644 KB Output is correct
114 Correct 82 ms 40560 KB Output is correct
115 Correct 89 ms 41308 KB Output is correct
116 Correct 65 ms 38800 KB Output is correct
117 Correct 85 ms 40856 KB Output is correct
118 Correct 71 ms 39936 KB Output is correct
119 Correct 70 ms 39660 KB Output is correct
120 Correct 89 ms 40900 KB Output is correct
121 Correct 87 ms 40644 KB Output is correct
122 Correct 91 ms 40808 KB Output is correct
123 Correct 91 ms 40864 KB Output is correct
124 Correct 88 ms 40916 KB Output is correct
125 Correct 75 ms 40052 KB Output is correct
126 Correct 53 ms 39268 KB Output is correct
127 Correct 67 ms 39500 KB Output is correct
128 Correct 70 ms 40760 KB Output is correct
129 Correct 80 ms 41924 KB Output is correct
130 Correct 410 ms 61728 KB Output is correct
131 Correct 294 ms 54596 KB Output is correct
132 Correct 400 ms 61688 KB Output is correct
133 Correct 397 ms 63184 KB Output is correct
134 Correct 390 ms 60376 KB Output is correct
135 Correct 424 ms 64544 KB Output is correct
136 Correct 399 ms 63396 KB Output is correct
137 Correct 392 ms 63312 KB Output is correct
138 Correct 386 ms 60860 KB Output is correct
139 Correct 405 ms 62740 KB Output is correct
140 Correct 400 ms 61244 KB Output is correct
141 Correct 414 ms 62704 KB Output is correct
142 Correct 414 ms 62648 KB Output is correct
143 Correct 432 ms 62584 KB Output is correct
144 Correct 410 ms 61836 KB Output is correct
145 Correct 413 ms 62660 KB Output is correct
146 Correct 425 ms 62080 KB Output is correct
147 Correct 427 ms 62696 KB Output is correct
148 Correct 460 ms 62632 KB Output is correct
149 Correct 421 ms 62696 KB Output is correct
150 Correct 193 ms 57356 KB Output is correct
151 Correct 305 ms 61636 KB Output is correct
152 Correct 312 ms 61612 KB Output is correct
153 Correct 342 ms 66796 KB Output is correct