답안 #631857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631857 2022-08-19T01:57:12 Z TheLostCookie 송신탑 (IOI22_towers) C++17
100 / 100
1588 ms 98728 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;

const int INF = 2e9;

#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
#define ROF(i,a,b) for(int i=(b)-1; i>=(a); --i)

typedef vector<int> vi;
typedef pair<int,int> ii;

struct SegmentTree {
	int v;
	int N;
	int minH,maxH;
	SegmentTree* left;
	SegmentTree* right;
	
	SegmentTree(SegmentTree* st) {
		v = st->v;
		N = st->N;
		minH = st->minH;
		maxH = st->maxH;
		left = st->left;
		right = st->right;
	}
	
	SegmentTree(int l, int r, vi &init, vi &H) {
		if(r-l==1) {
			left = right = nullptr;
			v = init[l];
			minH = maxH = H[l];
			N = H.size();
		} else {
			int m = (l+r)/2;
			left = new SegmentTree(l,m,init,H);
			right = new SegmentTree(m,r,init,H);
			pull();
		}
	}
	
	SegmentTree* modify(int p, int l, int r, int val) {
		if(l == r) return nullptr;
		SegmentTree* st = new SegmentTree(this);
		if(r-l == 1) {
			st->v += val;
		} else {
			int m = (l+r)/2;
			if(p < m) st->left = left->modify(p,l,m,val);
			else st->right = right->modify(p,m,r,val);
			st->pull();
		}
		return st;
	}
	
	SegmentTree* modify(int p, int val) {
		return modify(p,0,N,val);
	}
	
	int rangeQuerySum(int l, int r, int _l, int _r) {
		if(l >= _r || _l >= r) {
			return 0;
		} else if(_l <= l && r <= _r) {
			return v;
		} else {
			int m = (l+r)/2;
			int lq = left->rangeQuerySum(l,m,_l,_r);
			int rq = right->rangeQuerySum(m,r,_l,_r);
			return lq+rq;
		}
	}
	
	int rangeQuerySum(int l, int r) {
		return rangeQuerySum(0,N,l,r);
	}
	
	int rangeQueryMinHeight(int l, int r, int _l, int _r) {
		if(l >= _r || _l >= r) {
			return INF;
		} else if(_l <= l && r <= _r) {
			return minH;
		} else {
			int m = (l+r)/2;
			int lq = left->rangeQueryMinHeight(l,m,_l,_r);
			int rq = right->rangeQueryMinHeight(m,r,_l,_r);
			return min(lq,rq);
		}
	}
	
	int rangeQueryMinHeight(int l, int r) {
		return rangeQueryMinHeight(0,N,l,r);
	}
	
	int findFirst(int l, int r, int _l, int _r) {
		if(v==0 || l >= _r || _l >= r) {
			return -1;
		} else if(r-l==1) {
			return l;
		} else {
			int m = (l+r)/2;
			int ans = left->findFirst(l,m,_l,_r);
			if(ans == -1) return right->findFirst(m,r,_l,_r);
			else return ans;
		}
	}
	
	int findFirst(int l, int r) {
		return findFirst(0,N,l,r);
	}
	
	int findLast(int l, int r, int _l, int _r) {
		if(v==0 || l >= _r || _l >= r) {
			return -1;
		} else if(r-l==1) {
			return l;
		} else {
			int m = (l+r)/2;
			int ans = right->findLast(m,r,_l,_r);
			if(ans == -1) return left->findLast(l,m,_l,_r);
			else return ans;
		}
	}
	
	int findLast(int l, int r) {
		return findLast(0,N,l,r);
	}
	
	void pull() {
		N = left->N;
		v = left->v + right->v;
		minH = min(left->minH,right->minH);
		maxH = max(left->maxH,right->maxH);
	}
};

map<int,SegmentTree*> mp;
vector<int> heights;

void init(int N, std::vector<int> H) {
	heights = H;
	vi init(N,0);
	FOR(i,0,N) {
		if(i == 0 || i == N-1 || H[i] > max(H[i-1],H[i+1]) || H[i] < min(H[i-1],H[i+1])) {
			init[i] = 1;
		}
	}
	priority_queue<pair<int,ii>,vector<pair<int,ii>>,greater<pair<int,ii>>> pq;
	int prvH = -1, prvArg = -1;
	FOR(i,0,N) {
		if(init[i] == 1) {
			if(prvH != -1) {
				pq.push({abs(prvH-H[i]),{prvArg,i}});
			}
			prvH = H[i];
			prvArg = i;
		}
	}
	
	SegmentTree* st = new SegmentTree(0,N,init,H);
	mp[1] = st;
	
	while(!pq.empty()) {
		auto [d,v] = pq.top(); pq.pop();
		auto [i,j] = v;
		if(st->findFirst(i,i+1) == i && st->findFirst(j,j+1) == j) {
			int prv = st->findLast(0,i);
			int nxt = st->findFirst(j+1,N);
			if(prv != -1 && nxt != -1) {
				st = st->modify(i,-1);
				st = st->modify(j,-1);
				pq.push({abs(H[prv]-H[nxt]),{prv,nxt}});
			} else if(nxt != -1) {
				st = st->modify(i,-1);
			} else {
				st = st->modify(j,-1);
			}
			mp[d+1] = st;
		}
		
	}
	assert(st->findFirst(0,N) == st->findLast(0,N));
	return;
}

int max_towers(int L, int R, int D) {
	SegmentTree* st = prev(mp.upper_bound(D))->second;
	int ans = st->rangeQuerySum(L,R+1);
	if(ans == 0) return 1;
	else if(ans == 1) {
		int tow = st->findFirst(L,R+1);
		assert(tow == st->findLast(L,R+1));
		int prefMin = st->rangeQueryMinHeight(L,tow);
		if(prefMin <= heights[tow] - D) ans++;
		int suffMin = st->rangeQueryMinHeight(tow+1,R+1);
		if(suffMin <= heights[tow] - D) ans++;
		return (ans+1)/2;
	} else {
		int fi1 = st->findFirst(L,R+1);
		int fi2 = st->findFirst(fi1+1,R+1);
		int la1 = st->findLast(L,R+1);
		int la2 = st->findLast(L,la1);
		
		if(heights[fi1] > heights[fi2]) {
			int prefMin = st->rangeQueryMinHeight(L,fi1);
			if(prefMin <= heights[fi1] - D) ans++;
			else ans--;
		}
		if(heights[la1] > heights[la2]) {
			int suffMin = st->rangeQueryMinHeight(la1+1,R+1);
			if(suffMin <= heights[la1] - D) ans++;
			else ans--;
		}
		assert(ans%2 == 1);
		return (ans+1)/2;
	}
 
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 309 ms 6812 KB Output is correct
2 Correct 968 ms 11164 KB Output is correct
3 Correct 1037 ms 11192 KB Output is correct
4 Correct 897 ms 11208 KB Output is correct
5 Correct 814 ms 11168 KB Output is correct
6 Correct 999 ms 11208 KB Output is correct
7 Correct 896 ms 11176 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1232 KB Output is correct
3 Correct 3 ms 1232 KB Output is correct
4 Correct 4 ms 1712 KB Output is correct
5 Correct 3 ms 1616 KB Output is correct
6 Correct 3 ms 1616 KB Output is correct
7 Correct 3 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 3 ms 1616 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 5 ms 1696 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 4 ms 1692 KB Output is correct
29 Correct 3 ms 1616 KB Output is correct
30 Correct 3 ms 1616 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1232 KB Output is correct
3 Correct 3 ms 1232 KB Output is correct
4 Correct 4 ms 1712 KB Output is correct
5 Correct 3 ms 1616 KB Output is correct
6 Correct 3 ms 1616 KB Output is correct
7 Correct 3 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 3 ms 1616 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 5 ms 1696 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 4 ms 1692 KB Output is correct
29 Correct 3 ms 1616 KB Output is correct
30 Correct 3 ms 1616 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 101 ms 43712 KB Output is correct
37 Correct 168 ms 69564 KB Output is correct
38 Correct 169 ms 69260 KB Output is correct
39 Correct 251 ms 98620 KB Output is correct
40 Correct 257 ms 98516 KB Output is correct
41 Correct 259 ms 98592 KB Output is correct
42 Correct 281 ms 98588 KB Output is correct
43 Correct 18 ms 11164 KB Output is correct
44 Correct 22 ms 11192 KB Output is correct
45 Correct 18 ms 11168 KB Output is correct
46 Correct 19 ms 11208 KB Output is correct
47 Correct 178 ms 69372 KB Output is correct
48 Correct 254 ms 98568 KB Output is correct
49 Correct 258 ms 98572 KB Output is correct
50 Correct 23 ms 11208 KB Output is correct
51 Correct 19 ms 11168 KB Output is correct
52 Correct 178 ms 69412 KB Output is correct
53 Correct 266 ms 98572 KB Output is correct
54 Correct 259 ms 98632 KB Output is correct
55 Correct 20 ms 11208 KB Output is correct
56 Correct 18 ms 11184 KB Output is correct
57 Correct 178 ms 67012 KB Output is correct
58 Correct 174 ms 69464 KB Output is correct
59 Correct 180 ms 69672 KB Output is correct
60 Correct 267 ms 98576 KB Output is correct
61 Correct 248 ms 98536 KB Output is correct
62 Correct 252 ms 98552 KB Output is correct
63 Correct 256 ms 98728 KB Output is correct
64 Correct 17 ms 11208 KB Output is correct
65 Correct 19 ms 11164 KB Output is correct
66 Correct 19 ms 11180 KB Output is correct
67 Correct 19 ms 11168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1006 ms 68768 KB Output is correct
2 Correct 1371 ms 69388 KB Output is correct
3 Correct 1331 ms 69472 KB Output is correct
4 Correct 1553 ms 98540 KB Output is correct
5 Correct 1384 ms 98540 KB Output is correct
6 Correct 1366 ms 98520 KB Output is correct
7 Correct 1301 ms 98596 KB Output is correct
8 Correct 796 ms 11216 KB Output is correct
9 Correct 925 ms 11208 KB Output is correct
10 Correct 751 ms 11184 KB Output is correct
11 Correct 989 ms 11216 KB Output is correct
12 Correct 900 ms 11200 KB Output is correct
13 Correct 787 ms 11296 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 1 ms 464 KB Output is correct
17 Correct 183 ms 69432 KB Output is correct
18 Correct 266 ms 98568 KB Output is correct
19 Correct 255 ms 98620 KB Output is correct
20 Correct 27 ms 11188 KB Output is correct
21 Correct 19 ms 11164 KB Output is correct
22 Correct 190 ms 69336 KB Output is correct
23 Correct 259 ms 98616 KB Output is correct
24 Correct 257 ms 98584 KB Output is correct
25 Correct 19 ms 11152 KB Output is correct
26 Correct 18 ms 11172 KB Output is correct
27 Correct 2 ms 1232 KB Output is correct
28 Correct 3 ms 1708 KB Output is correct
29 Correct 3 ms 1616 KB Output is correct
30 Correct 1 ms 464 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 3 ms 1232 KB Output is correct
33 Correct 3 ms 1616 KB Output is correct
34 Correct 3 ms 1616 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 346 ms 15220 KB Output is correct
2 Correct 1115 ms 69436 KB Output is correct
3 Correct 1251 ms 69432 KB Output is correct
4 Correct 1242 ms 98600 KB Output is correct
5 Correct 1345 ms 98620 KB Output is correct
6 Correct 1182 ms 98668 KB Output is correct
7 Correct 1273 ms 98540 KB Output is correct
8 Correct 884 ms 11208 KB Output is correct
9 Correct 898 ms 11180 KB Output is correct
10 Correct 949 ms 11164 KB Output is correct
11 Correct 887 ms 11224 KB Output is correct
12 Correct 172 ms 69360 KB Output is correct
13 Correct 253 ms 98652 KB Output is correct
14 Correct 252 ms 98620 KB Output is correct
15 Correct 19 ms 11160 KB Output is correct
16 Correct 18 ms 11216 KB Output is correct
17 Correct 169 ms 67040 KB Output is correct
18 Correct 181 ms 69536 KB Output is correct
19 Correct 180 ms 69648 KB Output is correct
20 Correct 251 ms 98648 KB Output is correct
21 Correct 268 ms 98620 KB Output is correct
22 Correct 248 ms 98548 KB Output is correct
23 Correct 250 ms 98620 KB Output is correct
24 Correct 18 ms 11164 KB Output is correct
25 Correct 19 ms 11160 KB Output is correct
26 Correct 19 ms 11188 KB Output is correct
27 Correct 19 ms 11164 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 3 ms 1716 KB Output is correct
30 Correct 3 ms 1616 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 3 ms 1232 KB Output is correct
35 Correct 2 ms 1232 KB Output is correct
36 Correct 4 ms 1616 KB Output is correct
37 Correct 3 ms 1616 KB Output is correct
38 Correct 3 ms 1616 KB Output is correct
39 Correct 3 ms 1616 KB Output is correct
40 Correct 1 ms 464 KB Output is correct
41 Correct 1 ms 464 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1232 KB Output is correct
3 Correct 3 ms 1232 KB Output is correct
4 Correct 4 ms 1712 KB Output is correct
5 Correct 3 ms 1616 KB Output is correct
6 Correct 3 ms 1616 KB Output is correct
7 Correct 3 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 3 ms 1616 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 5 ms 1696 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 4 ms 1692 KB Output is correct
29 Correct 3 ms 1616 KB Output is correct
30 Correct 3 ms 1616 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 101 ms 43712 KB Output is correct
37 Correct 168 ms 69564 KB Output is correct
38 Correct 169 ms 69260 KB Output is correct
39 Correct 251 ms 98620 KB Output is correct
40 Correct 257 ms 98516 KB Output is correct
41 Correct 259 ms 98592 KB Output is correct
42 Correct 281 ms 98588 KB Output is correct
43 Correct 18 ms 11164 KB Output is correct
44 Correct 22 ms 11192 KB Output is correct
45 Correct 18 ms 11168 KB Output is correct
46 Correct 19 ms 11208 KB Output is correct
47 Correct 178 ms 69372 KB Output is correct
48 Correct 254 ms 98568 KB Output is correct
49 Correct 258 ms 98572 KB Output is correct
50 Correct 23 ms 11208 KB Output is correct
51 Correct 19 ms 11168 KB Output is correct
52 Correct 178 ms 69412 KB Output is correct
53 Correct 266 ms 98572 KB Output is correct
54 Correct 259 ms 98632 KB Output is correct
55 Correct 20 ms 11208 KB Output is correct
56 Correct 18 ms 11184 KB Output is correct
57 Correct 178 ms 67012 KB Output is correct
58 Correct 174 ms 69464 KB Output is correct
59 Correct 180 ms 69672 KB Output is correct
60 Correct 267 ms 98576 KB Output is correct
61 Correct 248 ms 98536 KB Output is correct
62 Correct 252 ms 98552 KB Output is correct
63 Correct 256 ms 98728 KB Output is correct
64 Correct 17 ms 11208 KB Output is correct
65 Correct 19 ms 11164 KB Output is correct
66 Correct 19 ms 11180 KB Output is correct
67 Correct 19 ms 11168 KB Output is correct
68 Correct 1006 ms 68768 KB Output is correct
69 Correct 1371 ms 69388 KB Output is correct
70 Correct 1331 ms 69472 KB Output is correct
71 Correct 1553 ms 98540 KB Output is correct
72 Correct 1384 ms 98540 KB Output is correct
73 Correct 1366 ms 98520 KB Output is correct
74 Correct 1301 ms 98596 KB Output is correct
75 Correct 796 ms 11216 KB Output is correct
76 Correct 925 ms 11208 KB Output is correct
77 Correct 751 ms 11184 KB Output is correct
78 Correct 989 ms 11216 KB Output is correct
79 Correct 900 ms 11200 KB Output is correct
80 Correct 787 ms 11296 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 1 ms 464 KB Output is correct
83 Correct 1 ms 464 KB Output is correct
84 Correct 183 ms 69432 KB Output is correct
85 Correct 266 ms 98568 KB Output is correct
86 Correct 255 ms 98620 KB Output is correct
87 Correct 27 ms 11188 KB Output is correct
88 Correct 19 ms 11164 KB Output is correct
89 Correct 190 ms 69336 KB Output is correct
90 Correct 259 ms 98616 KB Output is correct
91 Correct 257 ms 98584 KB Output is correct
92 Correct 19 ms 11152 KB Output is correct
93 Correct 18 ms 11172 KB Output is correct
94 Correct 2 ms 1232 KB Output is correct
95 Correct 3 ms 1708 KB Output is correct
96 Correct 3 ms 1616 KB Output is correct
97 Correct 1 ms 464 KB Output is correct
98 Correct 1 ms 464 KB Output is correct
99 Correct 3 ms 1232 KB Output is correct
100 Correct 3 ms 1616 KB Output is correct
101 Correct 3 ms 1616 KB Output is correct
102 Correct 1 ms 464 KB Output is correct
103 Correct 1 ms 464 KB Output is correct
104 Correct 1099 ms 61376 KB Output is correct
105 Correct 1277 ms 69308 KB Output is correct
106 Correct 1246 ms 69564 KB Output is correct
107 Correct 1393 ms 98620 KB Output is correct
108 Correct 1413 ms 98612 KB Output is correct
109 Correct 1488 ms 98580 KB Output is correct
110 Correct 1280 ms 98532 KB Output is correct
111 Correct 987 ms 11216 KB Output is correct
112 Correct 810 ms 11208 KB Output is correct
113 Correct 1012 ms 11216 KB Output is correct
114 Correct 967 ms 11208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 309 ms 6812 KB Output is correct
2 Correct 968 ms 11164 KB Output is correct
3 Correct 1037 ms 11192 KB Output is correct
4 Correct 897 ms 11208 KB Output is correct
5 Correct 814 ms 11168 KB Output is correct
6 Correct 999 ms 11208 KB Output is correct
7 Correct 896 ms 11176 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 2 ms 1232 KB Output is correct
13 Correct 3 ms 1232 KB Output is correct
14 Correct 4 ms 1712 KB Output is correct
15 Correct 3 ms 1616 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 3 ms 1616 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 1 ms 464 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 3 ms 1232 KB Output is correct
26 Correct 3 ms 1616 KB Output is correct
27 Correct 3 ms 1616 KB Output is correct
28 Correct 1 ms 464 KB Output is correct
29 Correct 1 ms 464 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 5 ms 1696 KB Output is correct
32 Correct 3 ms 1616 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 3 ms 1232 KB Output is correct
37 Correct 3 ms 1232 KB Output is correct
38 Correct 4 ms 1692 KB Output is correct
39 Correct 3 ms 1616 KB Output is correct
40 Correct 3 ms 1616 KB Output is correct
41 Correct 3 ms 1616 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
44 Correct 1 ms 464 KB Output is correct
45 Correct 1 ms 464 KB Output is correct
46 Correct 101 ms 43712 KB Output is correct
47 Correct 168 ms 69564 KB Output is correct
48 Correct 169 ms 69260 KB Output is correct
49 Correct 251 ms 98620 KB Output is correct
50 Correct 257 ms 98516 KB Output is correct
51 Correct 259 ms 98592 KB Output is correct
52 Correct 281 ms 98588 KB Output is correct
53 Correct 18 ms 11164 KB Output is correct
54 Correct 22 ms 11192 KB Output is correct
55 Correct 18 ms 11168 KB Output is correct
56 Correct 19 ms 11208 KB Output is correct
57 Correct 178 ms 69372 KB Output is correct
58 Correct 254 ms 98568 KB Output is correct
59 Correct 258 ms 98572 KB Output is correct
60 Correct 23 ms 11208 KB Output is correct
61 Correct 19 ms 11168 KB Output is correct
62 Correct 178 ms 69412 KB Output is correct
63 Correct 266 ms 98572 KB Output is correct
64 Correct 259 ms 98632 KB Output is correct
65 Correct 20 ms 11208 KB Output is correct
66 Correct 18 ms 11184 KB Output is correct
67 Correct 178 ms 67012 KB Output is correct
68 Correct 174 ms 69464 KB Output is correct
69 Correct 180 ms 69672 KB Output is correct
70 Correct 267 ms 98576 KB Output is correct
71 Correct 248 ms 98536 KB Output is correct
72 Correct 252 ms 98552 KB Output is correct
73 Correct 256 ms 98728 KB Output is correct
74 Correct 17 ms 11208 KB Output is correct
75 Correct 19 ms 11164 KB Output is correct
76 Correct 19 ms 11180 KB Output is correct
77 Correct 19 ms 11168 KB Output is correct
78 Correct 1006 ms 68768 KB Output is correct
79 Correct 1371 ms 69388 KB Output is correct
80 Correct 1331 ms 69472 KB Output is correct
81 Correct 1553 ms 98540 KB Output is correct
82 Correct 1384 ms 98540 KB Output is correct
83 Correct 1366 ms 98520 KB Output is correct
84 Correct 1301 ms 98596 KB Output is correct
85 Correct 796 ms 11216 KB Output is correct
86 Correct 925 ms 11208 KB Output is correct
87 Correct 751 ms 11184 KB Output is correct
88 Correct 989 ms 11216 KB Output is correct
89 Correct 900 ms 11200 KB Output is correct
90 Correct 787 ms 11296 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 1 ms 464 KB Output is correct
93 Correct 1 ms 464 KB Output is correct
94 Correct 183 ms 69432 KB Output is correct
95 Correct 266 ms 98568 KB Output is correct
96 Correct 255 ms 98620 KB Output is correct
97 Correct 27 ms 11188 KB Output is correct
98 Correct 19 ms 11164 KB Output is correct
99 Correct 190 ms 69336 KB Output is correct
100 Correct 259 ms 98616 KB Output is correct
101 Correct 257 ms 98584 KB Output is correct
102 Correct 19 ms 11152 KB Output is correct
103 Correct 18 ms 11172 KB Output is correct
104 Correct 2 ms 1232 KB Output is correct
105 Correct 3 ms 1708 KB Output is correct
106 Correct 3 ms 1616 KB Output is correct
107 Correct 1 ms 464 KB Output is correct
108 Correct 1 ms 464 KB Output is correct
109 Correct 3 ms 1232 KB Output is correct
110 Correct 3 ms 1616 KB Output is correct
111 Correct 3 ms 1616 KB Output is correct
112 Correct 1 ms 464 KB Output is correct
113 Correct 1 ms 464 KB Output is correct
114 Correct 346 ms 15220 KB Output is correct
115 Correct 1115 ms 69436 KB Output is correct
116 Correct 1251 ms 69432 KB Output is correct
117 Correct 1242 ms 98600 KB Output is correct
118 Correct 1345 ms 98620 KB Output is correct
119 Correct 1182 ms 98668 KB Output is correct
120 Correct 1273 ms 98540 KB Output is correct
121 Correct 884 ms 11208 KB Output is correct
122 Correct 898 ms 11180 KB Output is correct
123 Correct 949 ms 11164 KB Output is correct
124 Correct 887 ms 11224 KB Output is correct
125 Correct 172 ms 69360 KB Output is correct
126 Correct 253 ms 98652 KB Output is correct
127 Correct 252 ms 98620 KB Output is correct
128 Correct 19 ms 11160 KB Output is correct
129 Correct 18 ms 11216 KB Output is correct
130 Correct 169 ms 67040 KB Output is correct
131 Correct 181 ms 69536 KB Output is correct
132 Correct 180 ms 69648 KB Output is correct
133 Correct 251 ms 98648 KB Output is correct
134 Correct 268 ms 98620 KB Output is correct
135 Correct 248 ms 98548 KB Output is correct
136 Correct 250 ms 98620 KB Output is correct
137 Correct 18 ms 11164 KB Output is correct
138 Correct 19 ms 11160 KB Output is correct
139 Correct 19 ms 11188 KB Output is correct
140 Correct 19 ms 11164 KB Output is correct
141 Correct 2 ms 1232 KB Output is correct
142 Correct 3 ms 1716 KB Output is correct
143 Correct 3 ms 1616 KB Output is correct
144 Correct 1 ms 464 KB Output is correct
145 Correct 1 ms 464 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 3 ms 1232 KB Output is correct
148 Correct 2 ms 1232 KB Output is correct
149 Correct 4 ms 1616 KB Output is correct
150 Correct 3 ms 1616 KB Output is correct
151 Correct 3 ms 1616 KB Output is correct
152 Correct 3 ms 1616 KB Output is correct
153 Correct 1 ms 464 KB Output is correct
154 Correct 1 ms 464 KB Output is correct
155 Correct 1 ms 464 KB Output is correct
156 Correct 1 ms 464 KB Output is correct
157 Correct 1099 ms 61376 KB Output is correct
158 Correct 1277 ms 69308 KB Output is correct
159 Correct 1246 ms 69564 KB Output is correct
160 Correct 1393 ms 98620 KB Output is correct
161 Correct 1413 ms 98612 KB Output is correct
162 Correct 1488 ms 98580 KB Output is correct
163 Correct 1280 ms 98532 KB Output is correct
164 Correct 987 ms 11216 KB Output is correct
165 Correct 810 ms 11208 KB Output is correct
166 Correct 1012 ms 11216 KB Output is correct
167 Correct 967 ms 11208 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 950 ms 22592 KB Output is correct
170 Correct 1503 ms 69112 KB Output is correct
171 Correct 1321 ms 69436 KB Output is correct
172 Correct 1461 ms 98596 KB Output is correct
173 Correct 1471 ms 98620 KB Output is correct
174 Correct 1588 ms 98572 KB Output is correct
175 Correct 1522 ms 98708 KB Output is correct
176 Correct 931 ms 11160 KB Output is correct
177 Correct 906 ms 11208 KB Output is correct
178 Correct 939 ms 11164 KB Output is correct
179 Correct 888 ms 11172 KB Output is correct