Submission #416203

# Submission time Handle Problem Language Result Execution time Memory
416203 2021-06-02T07:17:03 Z alireza_kaviani Food Court (JOI21_foodcourt) C++11
100 / 100
685 ms 64720 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)						(x).begin(),(x).end()
#define X							first
#define Y							second
#define sep							' '
#define endl						'\n'
#define SZ(x)						ll(x.size())
#define lc							id << 1
#define rc							lc | 1

const ll MAXN = 25e4 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; //998244353; //1e9 + 9;

struct query{
	int type , l , r;
	ll val;
};

int n , m , q , col[MAXN];
ll fen[MAXN] , mn[MAXN << 2] , seg[MAXN << 2] , lz2[MAXN << 2] , ans[MAXN];
pll lz[MAXN << 2];
vector<pll> vec[MAXN << 2];
vector<query> Q = {{0 , 0 , 0 , 0}};

void add(int x , int val){
	for( x++ ; x < MAXN ; x += x & -x)	fen[x] += val;
}

ll get(int x){
	ll ans = 0;
	for( x++ ; x ; x -= x & -x)	ans += fen[x];
	return ans;
}

void apply(int id , pll val){
	mn[id] = max(mn[id] + val.X , val.Y);
	lz[id].X += val.X;
	lz[id].Y = max(val.Y , val.X + lz[id].Y);
}

void update(int ql , int qr , int val , int id = 1 , int l = 0 , int r = n){
	if(qr <= l || r <= ql)	return;
	if(ql <= l && r <= qr){
		apply(id , pll(val , 0));
		return;
	}
	int mid = l + r >> 1;
	apply(lc , lz[id]); apply(rc , lz[id]); lz[id] = {0 , 0};
	update(ql , qr , val , lc , l , mid);
	update(ql , qr , val , rc , mid , r);
	mn[id] = min(mn[lc] , mn[rc]);
}

ll getVal(int x , int id = 1 , int l = 0 , int r = n){
	if(r - l == 1)	return mn[id];
	int mid = l + r >> 1;
	apply(lc , lz[id]); apply(rc , lz[id]); lz[id] = {0 , 0};
	if(x < mid)	return getVal(x , lc , l , mid);
	return getVal(x , rc , mid , r);
}

void insert(int x , pll y , int id = 1 , int l = 0 , int r = n){
	if(r - l == 1){
		vec[id].push_back(y);
		return;
	}
	int mid = l + r >> 1;
	if(x < mid)	insert(x , y , lc , l , mid);
	else	insert(x , y , rc , mid , r);
}

void build(int id = 1 , int l = 0 , int r = n){
	if(r - l == 1){
		sort(all(vec[id]) , greater<pll>());
		if(SZ(vec[id]) == 0)	seg[id] = INF;
		else	seg[id] = vec[id].back().X;
		return;
	}
	int mid = l + r >> 1;
	build(lc , l , mid);
	build(rc , mid , r);
	seg[id] = min(seg[lc] , seg[rc]);
}

void shift(int id){
	lz2[lc] += lz2[id]; seg[lc] -= lz2[id];
	lz2[rc] += lz2[id]; seg[rc] -= lz2[id];
	lz2[id] = 0;
}

void solve(int ql , int qr , int val , int col , int id = 1 , int l = 0 , int r = n){
	if(qr <= l || r <= ql)	return;
	if(ql <= l && r <= qr && seg[id] > val){
		lz2[id] += val;
		seg[id] -= val;
		return;
	}
	if(r - l == 1){
		lz2[id] += val;
		seg[id] -= val;
		while(seg[id] <= 0){
			if(SZ(vec[id]) > 1){
				seg[id] += vec[id][SZ(vec[id]) - 2].X - vec[id].back().X;
			}
			else	seg[id] = INF;
			ans[vec[id].back().Y] = col;
			vec[id].pop_back();
		}
		return;
	}
	shift(id);
	int mid = l + r >> 1;
	solve(ql , qr , val , col , lc , l , mid);
	solve(ql , qr , val , col , rc,  mid , r);
	seg[id] = min(seg[lc] , seg[rc]);
}

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

	cin >> n >> m >> q;
	for(int i = 1 ; i <= q ; i++){
		ll type , l , r = -1 , val;
		cin >> type;
		if(type == 1){
			cin >> l >> r >> col[i] >> val; l--;
			add(l , val);
			add(r , -val);
			update(l , r , val);
		}
		if(type == 2){
			cin >> l >> r >> val; l--;
			update(l , r , -val);
		}
		if(type == 3){
			cin >> l >> val; l--;
			ll res = get(l) - getVal(l) + val;
			ans[i] = -1;
			if(res > get(l)){
				Q.push_back({type , l , r , val});
				continue;
			}
			insert(l , {res , i});
		}
		Q.push_back({type , l , r , val});
	}
	build();
	for(int i = 1 ; i <= q ; i++){
//		cout << i << sep << col[i] << endl;
		ll type = Q[i].type , l = Q[i].l , r = Q[i].r , val = Q[i].val;
		if(type == 1){
//			cout << i << endl;
			solve(l , r , val , col[i]);
		}
	}
	for(int i = 1 ; i <= q ; i++){
		//cout << i << sep << ans[i] << endl;
		if(ans[i] == 0)	continue;
		cout << max(ans[i] , 0ll) << endl;
	}

    return 0;
}
/*

*/

Compilation message

foodcourt.cpp: In function 'void update(int, int, int, int, int, int)':
foodcourt.cpp:55:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   55 |  int mid = l + r >> 1;
      |            ~~^~~
foodcourt.cpp: In function 'll getVal(int, int, int, int)':
foodcourt.cpp:64:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   64 |  int mid = l + r >> 1;
      |            ~~^~~
foodcourt.cpp: In function 'void insert(int, pll, int, int, int)':
foodcourt.cpp:75:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   75 |  int mid = l + r >> 1;
      |            ~~^~~
foodcourt.cpp: In function 'void build(int, int, int)':
foodcourt.cpp:87:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   87 |  int mid = l + r >> 1;
      |            ~~^~~
foodcourt.cpp: In function 'void solve(int, int, int, int, int, int, int)':
foodcourt.cpp:120:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  120 |  int mid = l + r >> 1;
      |            ~~^~~
foodcourt.cpp: In function 'int main()':
foodcourt.cpp:148:18: warning: narrowing conversion of 'type' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  148 |     Q.push_back({type , l , r , val});
      |                  ^~~~
foodcourt.cpp:148:25: warning: narrowing conversion of 'l' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  148 |     Q.push_back({type , l , r , val});
      |                         ^
foodcourt.cpp:148:29: warning: narrowing conversion of 'r' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  148 |     Q.push_back({type , l , r , val});
      |                             ^
foodcourt.cpp:153:16: warning: narrowing conversion of 'type' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  153 |   Q.push_back({type , l , r , val});
      |                ^~~~
foodcourt.cpp:153:23: warning: narrowing conversion of 'l' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  153 |   Q.push_back({type , l , r , val});
      |                       ^
foodcourt.cpp:153:27: warning: narrowing conversion of 'r' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
  153 |   Q.push_back({type , l , r , val});
      |                           ^
# Verdict Execution time Memory Grader output
1 Correct 15 ms 24208 KB Output is correct
2 Correct 15 ms 24132 KB Output is correct
3 Correct 15 ms 24144 KB Output is correct
4 Correct 16 ms 24212 KB Output is correct
5 Correct 14 ms 23948 KB Output is correct
6 Correct 15 ms 24012 KB Output is correct
7 Correct 16 ms 24208 KB Output is correct
8 Correct 16 ms 24140 KB Output is correct
9 Correct 16 ms 24208 KB Output is correct
10 Correct 16 ms 24212 KB Output is correct
11 Correct 17 ms 24140 KB Output is correct
12 Correct 16 ms 24208 KB Output is correct
13 Correct 16 ms 24172 KB Output is correct
14 Correct 15 ms 24212 KB Output is correct
15 Correct 16 ms 24140 KB Output is correct
16 Correct 16 ms 24104 KB Output is correct
17 Correct 16 ms 24116 KB Output is correct
18 Correct 16 ms 24156 KB Output is correct
19 Correct 16 ms 24208 KB Output is correct
20 Correct 16 ms 24128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 24208 KB Output is correct
2 Correct 15 ms 24132 KB Output is correct
3 Correct 15 ms 24144 KB Output is correct
4 Correct 16 ms 24212 KB Output is correct
5 Correct 14 ms 23948 KB Output is correct
6 Correct 15 ms 24012 KB Output is correct
7 Correct 16 ms 24208 KB Output is correct
8 Correct 16 ms 24140 KB Output is correct
9 Correct 16 ms 24208 KB Output is correct
10 Correct 16 ms 24212 KB Output is correct
11 Correct 17 ms 24140 KB Output is correct
12 Correct 16 ms 24208 KB Output is correct
13 Correct 16 ms 24172 KB Output is correct
14 Correct 15 ms 24212 KB Output is correct
15 Correct 16 ms 24140 KB Output is correct
16 Correct 16 ms 24104 KB Output is correct
17 Correct 16 ms 24116 KB Output is correct
18 Correct 16 ms 24156 KB Output is correct
19 Correct 16 ms 24208 KB Output is correct
20 Correct 16 ms 24128 KB Output is correct
21 Correct 16 ms 24120 KB Output is correct
22 Correct 18 ms 24140 KB Output is correct
23 Correct 16 ms 24208 KB Output is correct
24 Correct 16 ms 24204 KB Output is correct
25 Correct 15 ms 24012 KB Output is correct
26 Correct 15 ms 24016 KB Output is correct
27 Correct 16 ms 24212 KB Output is correct
28 Correct 19 ms 24168 KB Output is correct
29 Correct 15 ms 24208 KB Output is correct
30 Correct 18 ms 24204 KB Output is correct
31 Correct 16 ms 24176 KB Output is correct
32 Correct 16 ms 24140 KB Output is correct
33 Correct 16 ms 24216 KB Output is correct
34 Correct 15 ms 24140 KB Output is correct
35 Correct 15 ms 24168 KB Output is correct
36 Correct 17 ms 24300 KB Output is correct
37 Correct 15 ms 24160 KB Output is correct
38 Correct 16 ms 24088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 33092 KB Output is correct
2 Correct 103 ms 33200 KB Output is correct
3 Correct 110 ms 33084 KB Output is correct
4 Correct 125 ms 33140 KB Output is correct
5 Correct 99 ms 33144 KB Output is correct
6 Correct 101 ms 33176 KB Output is correct
7 Correct 42 ms 27024 KB Output is correct
8 Correct 41 ms 27052 KB Output is correct
9 Correct 101 ms 33076 KB Output is correct
10 Correct 100 ms 33152 KB Output is correct
11 Correct 108 ms 33076 KB Output is correct
12 Correct 105 ms 33240 KB Output is correct
13 Correct 90 ms 32512 KB Output is correct
14 Correct 113 ms 33112 KB Output is correct
15 Correct 102 ms 33000 KB Output is correct
16 Correct 107 ms 33236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 562 ms 61184 KB Output is correct
2 Correct 416 ms 57976 KB Output is correct
3 Correct 603 ms 62848 KB Output is correct
4 Correct 477 ms 58100 KB Output is correct
5 Correct 489 ms 57972 KB Output is correct
6 Correct 677 ms 62652 KB Output is correct
7 Correct 135 ms 38856 KB Output is correct
8 Correct 138 ms 38448 KB Output is correct
9 Correct 682 ms 63952 KB Output is correct
10 Correct 660 ms 63832 KB Output is correct
11 Correct 595 ms 62140 KB Output is correct
12 Correct 645 ms 62576 KB Output is correct
13 Correct 594 ms 62136 KB Output is correct
14 Correct 597 ms 62472 KB Output is correct
15 Correct 592 ms 62564 KB Output is correct
16 Correct 587 ms 62396 KB Output is correct
17 Correct 618 ms 62508 KB Output is correct
18 Correct 603 ms 62236 KB Output is correct
19 Correct 603 ms 62596 KB Output is correct
20 Correct 590 ms 62316 KB Output is correct
21 Correct 615 ms 62432 KB Output is correct
22 Correct 610 ms 62412 KB Output is correct
23 Correct 597 ms 62508 KB Output is correct
24 Correct 616 ms 62528 KB Output is correct
25 Correct 484 ms 60556 KB Output is correct
26 Correct 498 ms 60684 KB Output is correct
27 Correct 465 ms 60968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 24208 KB Output is correct
2 Correct 15 ms 24132 KB Output is correct
3 Correct 15 ms 24144 KB Output is correct
4 Correct 16 ms 24212 KB Output is correct
5 Correct 14 ms 23948 KB Output is correct
6 Correct 15 ms 24012 KB Output is correct
7 Correct 16 ms 24208 KB Output is correct
8 Correct 16 ms 24140 KB Output is correct
9 Correct 16 ms 24208 KB Output is correct
10 Correct 16 ms 24212 KB Output is correct
11 Correct 17 ms 24140 KB Output is correct
12 Correct 16 ms 24208 KB Output is correct
13 Correct 16 ms 24172 KB Output is correct
14 Correct 15 ms 24212 KB Output is correct
15 Correct 16 ms 24140 KB Output is correct
16 Correct 16 ms 24104 KB Output is correct
17 Correct 16 ms 24116 KB Output is correct
18 Correct 16 ms 24156 KB Output is correct
19 Correct 16 ms 24208 KB Output is correct
20 Correct 16 ms 24128 KB Output is correct
21 Correct 94 ms 33092 KB Output is correct
22 Correct 103 ms 33200 KB Output is correct
23 Correct 110 ms 33084 KB Output is correct
24 Correct 125 ms 33140 KB Output is correct
25 Correct 99 ms 33144 KB Output is correct
26 Correct 101 ms 33176 KB Output is correct
27 Correct 42 ms 27024 KB Output is correct
28 Correct 41 ms 27052 KB Output is correct
29 Correct 101 ms 33076 KB Output is correct
30 Correct 100 ms 33152 KB Output is correct
31 Correct 108 ms 33076 KB Output is correct
32 Correct 105 ms 33240 KB Output is correct
33 Correct 90 ms 32512 KB Output is correct
34 Correct 113 ms 33112 KB Output is correct
35 Correct 102 ms 33000 KB Output is correct
36 Correct 107 ms 33236 KB Output is correct
37 Correct 107 ms 32836 KB Output is correct
38 Correct 107 ms 32540 KB Output is correct
39 Correct 36 ms 26720 KB Output is correct
40 Correct 40 ms 26932 KB Output is correct
41 Correct 118 ms 33092 KB Output is correct
42 Correct 121 ms 33232 KB Output is correct
43 Correct 124 ms 33224 KB Output is correct
44 Correct 121 ms 33172 KB Output is correct
45 Correct 120 ms 33188 KB Output is correct
46 Correct 124 ms 33200 KB Output is correct
47 Correct 65 ms 32636 KB Output is correct
48 Correct 112 ms 32852 KB Output is correct
49 Correct 100 ms 31904 KB Output is correct
50 Correct 105 ms 32628 KB Output is correct
51 Correct 124 ms 33284 KB Output is correct
52 Correct 123 ms 33096 KB Output is correct
53 Correct 86 ms 32264 KB Output is correct
54 Correct 103 ms 33112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 118 ms 33664 KB Output is correct
2 Correct 136 ms 34084 KB Output is correct
3 Correct 136 ms 34204 KB Output is correct
4 Correct 100 ms 32736 KB Output is correct
5 Correct 119 ms 33544 KB Output is correct
6 Correct 138 ms 34164 KB Output is correct
7 Correct 47 ms 28016 KB Output is correct
8 Correct 47 ms 27640 KB Output is correct
9 Correct 81 ms 33604 KB Output is correct
10 Correct 96 ms 32168 KB Output is correct
11 Correct 126 ms 33636 KB Output is correct
12 Correct 130 ms 33648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 24208 KB Output is correct
2 Correct 15 ms 24132 KB Output is correct
3 Correct 15 ms 24144 KB Output is correct
4 Correct 16 ms 24212 KB Output is correct
5 Correct 14 ms 23948 KB Output is correct
6 Correct 15 ms 24012 KB Output is correct
7 Correct 16 ms 24208 KB Output is correct
8 Correct 16 ms 24140 KB Output is correct
9 Correct 16 ms 24208 KB Output is correct
10 Correct 16 ms 24212 KB Output is correct
11 Correct 17 ms 24140 KB Output is correct
12 Correct 16 ms 24208 KB Output is correct
13 Correct 16 ms 24172 KB Output is correct
14 Correct 15 ms 24212 KB Output is correct
15 Correct 16 ms 24140 KB Output is correct
16 Correct 16 ms 24104 KB Output is correct
17 Correct 16 ms 24116 KB Output is correct
18 Correct 16 ms 24156 KB Output is correct
19 Correct 16 ms 24208 KB Output is correct
20 Correct 16 ms 24128 KB Output is correct
21 Correct 16 ms 24120 KB Output is correct
22 Correct 18 ms 24140 KB Output is correct
23 Correct 16 ms 24208 KB Output is correct
24 Correct 16 ms 24204 KB Output is correct
25 Correct 15 ms 24012 KB Output is correct
26 Correct 15 ms 24016 KB Output is correct
27 Correct 16 ms 24212 KB Output is correct
28 Correct 19 ms 24168 KB Output is correct
29 Correct 15 ms 24208 KB Output is correct
30 Correct 18 ms 24204 KB Output is correct
31 Correct 16 ms 24176 KB Output is correct
32 Correct 16 ms 24140 KB Output is correct
33 Correct 16 ms 24216 KB Output is correct
34 Correct 15 ms 24140 KB Output is correct
35 Correct 15 ms 24168 KB Output is correct
36 Correct 17 ms 24300 KB Output is correct
37 Correct 15 ms 24160 KB Output is correct
38 Correct 16 ms 24088 KB Output is correct
39 Correct 94 ms 33092 KB Output is correct
40 Correct 103 ms 33200 KB Output is correct
41 Correct 110 ms 33084 KB Output is correct
42 Correct 125 ms 33140 KB Output is correct
43 Correct 99 ms 33144 KB Output is correct
44 Correct 101 ms 33176 KB Output is correct
45 Correct 42 ms 27024 KB Output is correct
46 Correct 41 ms 27052 KB Output is correct
47 Correct 101 ms 33076 KB Output is correct
48 Correct 100 ms 33152 KB Output is correct
49 Correct 108 ms 33076 KB Output is correct
50 Correct 105 ms 33240 KB Output is correct
51 Correct 90 ms 32512 KB Output is correct
52 Correct 113 ms 33112 KB Output is correct
53 Correct 102 ms 33000 KB Output is correct
54 Correct 107 ms 33236 KB Output is correct
55 Correct 107 ms 32836 KB Output is correct
56 Correct 107 ms 32540 KB Output is correct
57 Correct 36 ms 26720 KB Output is correct
58 Correct 40 ms 26932 KB Output is correct
59 Correct 118 ms 33092 KB Output is correct
60 Correct 121 ms 33232 KB Output is correct
61 Correct 124 ms 33224 KB Output is correct
62 Correct 121 ms 33172 KB Output is correct
63 Correct 120 ms 33188 KB Output is correct
64 Correct 124 ms 33200 KB Output is correct
65 Correct 65 ms 32636 KB Output is correct
66 Correct 112 ms 32852 KB Output is correct
67 Correct 100 ms 31904 KB Output is correct
68 Correct 105 ms 32628 KB Output is correct
69 Correct 124 ms 33284 KB Output is correct
70 Correct 123 ms 33096 KB Output is correct
71 Correct 86 ms 32264 KB Output is correct
72 Correct 103 ms 33112 KB Output is correct
73 Correct 118 ms 33664 KB Output is correct
74 Correct 136 ms 34084 KB Output is correct
75 Correct 136 ms 34204 KB Output is correct
76 Correct 100 ms 32736 KB Output is correct
77 Correct 119 ms 33544 KB Output is correct
78 Correct 138 ms 34164 KB Output is correct
79 Correct 47 ms 28016 KB Output is correct
80 Correct 47 ms 27640 KB Output is correct
81 Correct 81 ms 33604 KB Output is correct
82 Correct 96 ms 32168 KB Output is correct
83 Correct 126 ms 33636 KB Output is correct
84 Correct 130 ms 33648 KB Output is correct
85 Correct 118 ms 33364 KB Output is correct
86 Correct 131 ms 33836 KB Output is correct
87 Correct 122 ms 33252 KB Output is correct
88 Correct 138 ms 33804 KB Output is correct
89 Correct 88 ms 32204 KB Output is correct
90 Correct 127 ms 33740 KB Output is correct
91 Correct 102 ms 32844 KB Output is correct
92 Correct 107 ms 32644 KB Output is correct
93 Correct 125 ms 33740 KB Output is correct
94 Correct 127 ms 33764 KB Output is correct
95 Correct 122 ms 33548 KB Output is correct
96 Correct 127 ms 33772 KB Output is correct
97 Correct 126 ms 33664 KB Output is correct
98 Correct 108 ms 32964 KB Output is correct
99 Correct 69 ms 33152 KB Output is correct
100 Correct 100 ms 32584 KB Output is correct
101 Correct 122 ms 33272 KB Output is correct
102 Correct 111 ms 33336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 24208 KB Output is correct
2 Correct 15 ms 24132 KB Output is correct
3 Correct 15 ms 24144 KB Output is correct
4 Correct 16 ms 24212 KB Output is correct
5 Correct 14 ms 23948 KB Output is correct
6 Correct 15 ms 24012 KB Output is correct
7 Correct 16 ms 24208 KB Output is correct
8 Correct 16 ms 24140 KB Output is correct
9 Correct 16 ms 24208 KB Output is correct
10 Correct 16 ms 24212 KB Output is correct
11 Correct 17 ms 24140 KB Output is correct
12 Correct 16 ms 24208 KB Output is correct
13 Correct 16 ms 24172 KB Output is correct
14 Correct 15 ms 24212 KB Output is correct
15 Correct 16 ms 24140 KB Output is correct
16 Correct 16 ms 24104 KB Output is correct
17 Correct 16 ms 24116 KB Output is correct
18 Correct 16 ms 24156 KB Output is correct
19 Correct 16 ms 24208 KB Output is correct
20 Correct 16 ms 24128 KB Output is correct
21 Correct 16 ms 24120 KB Output is correct
22 Correct 18 ms 24140 KB Output is correct
23 Correct 16 ms 24208 KB Output is correct
24 Correct 16 ms 24204 KB Output is correct
25 Correct 15 ms 24012 KB Output is correct
26 Correct 15 ms 24016 KB Output is correct
27 Correct 16 ms 24212 KB Output is correct
28 Correct 19 ms 24168 KB Output is correct
29 Correct 15 ms 24208 KB Output is correct
30 Correct 18 ms 24204 KB Output is correct
31 Correct 16 ms 24176 KB Output is correct
32 Correct 16 ms 24140 KB Output is correct
33 Correct 16 ms 24216 KB Output is correct
34 Correct 15 ms 24140 KB Output is correct
35 Correct 15 ms 24168 KB Output is correct
36 Correct 17 ms 24300 KB Output is correct
37 Correct 15 ms 24160 KB Output is correct
38 Correct 16 ms 24088 KB Output is correct
39 Correct 94 ms 33092 KB Output is correct
40 Correct 103 ms 33200 KB Output is correct
41 Correct 110 ms 33084 KB Output is correct
42 Correct 125 ms 33140 KB Output is correct
43 Correct 99 ms 33144 KB Output is correct
44 Correct 101 ms 33176 KB Output is correct
45 Correct 42 ms 27024 KB Output is correct
46 Correct 41 ms 27052 KB Output is correct
47 Correct 101 ms 33076 KB Output is correct
48 Correct 100 ms 33152 KB Output is correct
49 Correct 108 ms 33076 KB Output is correct
50 Correct 105 ms 33240 KB Output is correct
51 Correct 90 ms 32512 KB Output is correct
52 Correct 113 ms 33112 KB Output is correct
53 Correct 102 ms 33000 KB Output is correct
54 Correct 107 ms 33236 KB Output is correct
55 Correct 562 ms 61184 KB Output is correct
56 Correct 416 ms 57976 KB Output is correct
57 Correct 603 ms 62848 KB Output is correct
58 Correct 477 ms 58100 KB Output is correct
59 Correct 489 ms 57972 KB Output is correct
60 Correct 677 ms 62652 KB Output is correct
61 Correct 135 ms 38856 KB Output is correct
62 Correct 138 ms 38448 KB Output is correct
63 Correct 682 ms 63952 KB Output is correct
64 Correct 660 ms 63832 KB Output is correct
65 Correct 595 ms 62140 KB Output is correct
66 Correct 645 ms 62576 KB Output is correct
67 Correct 594 ms 62136 KB Output is correct
68 Correct 597 ms 62472 KB Output is correct
69 Correct 592 ms 62564 KB Output is correct
70 Correct 587 ms 62396 KB Output is correct
71 Correct 618 ms 62508 KB Output is correct
72 Correct 603 ms 62236 KB Output is correct
73 Correct 603 ms 62596 KB Output is correct
74 Correct 590 ms 62316 KB Output is correct
75 Correct 615 ms 62432 KB Output is correct
76 Correct 610 ms 62412 KB Output is correct
77 Correct 597 ms 62508 KB Output is correct
78 Correct 616 ms 62528 KB Output is correct
79 Correct 484 ms 60556 KB Output is correct
80 Correct 498 ms 60684 KB Output is correct
81 Correct 465 ms 60968 KB Output is correct
82 Correct 107 ms 32836 KB Output is correct
83 Correct 107 ms 32540 KB Output is correct
84 Correct 36 ms 26720 KB Output is correct
85 Correct 40 ms 26932 KB Output is correct
86 Correct 118 ms 33092 KB Output is correct
87 Correct 121 ms 33232 KB Output is correct
88 Correct 124 ms 33224 KB Output is correct
89 Correct 121 ms 33172 KB Output is correct
90 Correct 120 ms 33188 KB Output is correct
91 Correct 124 ms 33200 KB Output is correct
92 Correct 65 ms 32636 KB Output is correct
93 Correct 112 ms 32852 KB Output is correct
94 Correct 100 ms 31904 KB Output is correct
95 Correct 105 ms 32628 KB Output is correct
96 Correct 124 ms 33284 KB Output is correct
97 Correct 123 ms 33096 KB Output is correct
98 Correct 86 ms 32264 KB Output is correct
99 Correct 103 ms 33112 KB Output is correct
100 Correct 118 ms 33664 KB Output is correct
101 Correct 136 ms 34084 KB Output is correct
102 Correct 136 ms 34204 KB Output is correct
103 Correct 100 ms 32736 KB Output is correct
104 Correct 119 ms 33544 KB Output is correct
105 Correct 138 ms 34164 KB Output is correct
106 Correct 47 ms 28016 KB Output is correct
107 Correct 47 ms 27640 KB Output is correct
108 Correct 81 ms 33604 KB Output is correct
109 Correct 96 ms 32168 KB Output is correct
110 Correct 126 ms 33636 KB Output is correct
111 Correct 130 ms 33648 KB Output is correct
112 Correct 118 ms 33364 KB Output is correct
113 Correct 131 ms 33836 KB Output is correct
114 Correct 122 ms 33252 KB Output is correct
115 Correct 138 ms 33804 KB Output is correct
116 Correct 88 ms 32204 KB Output is correct
117 Correct 127 ms 33740 KB Output is correct
118 Correct 102 ms 32844 KB Output is correct
119 Correct 107 ms 32644 KB Output is correct
120 Correct 125 ms 33740 KB Output is correct
121 Correct 127 ms 33764 KB Output is correct
122 Correct 122 ms 33548 KB Output is correct
123 Correct 127 ms 33772 KB Output is correct
124 Correct 126 ms 33664 KB Output is correct
125 Correct 108 ms 32964 KB Output is correct
126 Correct 69 ms 33152 KB Output is correct
127 Correct 100 ms 32584 KB Output is correct
128 Correct 122 ms 33272 KB Output is correct
129 Correct 111 ms 33336 KB Output is correct
130 Correct 588 ms 63352 KB Output is correct
131 Correct 414 ms 58264 KB Output is correct
132 Correct 591 ms 63476 KB Output is correct
133 Correct 627 ms 62684 KB Output is correct
134 Correct 567 ms 60860 KB Output is correct
135 Correct 656 ms 63532 KB Output is correct
136 Correct 674 ms 64692 KB Output is correct
137 Correct 685 ms 64720 KB Output is correct
138 Correct 648 ms 62700 KB Output is correct
139 Correct 637 ms 63204 KB Output is correct
140 Correct 637 ms 62776 KB Output is correct
141 Correct 654 ms 63172 KB Output is correct
142 Correct 682 ms 63224 KB Output is correct
143 Correct 670 ms 63152 KB Output is correct
144 Correct 665 ms 62912 KB Output is correct
145 Correct 663 ms 63312 KB Output is correct
146 Correct 651 ms 62900 KB Output is correct
147 Correct 665 ms 63264 KB Output is correct
148 Correct 684 ms 63052 KB Output is correct
149 Correct 667 ms 63152 KB Output is correct
150 Correct 292 ms 60824 KB Output is correct
151 Correct 507 ms 61424 KB Output is correct
152 Correct 518 ms 61392 KB Output is correct
153 Correct 504 ms 61732 KB Output is correct