답안 #748818

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
748818 2023-05-27T03:57:17 Z QwertyPi 송신탑 (IOI22_towers) C++17
100 / 100
1833 ms 110504 KB
#include "towers.h"
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

namespace solve{
	int N; vector<int> H;
	vector<bool> active;
	struct node{
		int l, r, s; node *ll, *rr;
		node(int l, int r, int s = 1) : l(l), r(r), s(s), ll(0), rr(0) {};
		node(node *ll, node *rr) : l(ll->l), r(rr->r), s(ll->s + rr->s), ll(ll), rr(rr) {};
	};
	
	map<int, node*> ans;
	
	node* build(int l, int r){
		node* p = new node(l, r);
		if (l != r) {
			int m = (l + r) / 2;
			p->ll = build(l, m);
			p->rr = build(m + 1, r);
			p->s = p->ll->s + p->rr->s;
		} else {
			p->s = active[l];
		}
		return p;
	}
	
	node* update(node* root, int p, int v){
		if(root->l == root->r)
			return new node(root->l, root->r, v);
		
		if(p <= root->ll->r){
			node *x = update(root->ll, p, v);
			node *y = root->rr;
			return new node(x, y);
		}else{
			node *x = root->ll;
			node *y = update(root->rr, p, v);
			return new node(x, y);
		}
	}
	
	void crawl(node* v, bool ini = true){
		if(v == nullptr)
			return;
		if(v->ll || v->rr) {
			crawl(v->ll, false);
			crawl(v->rr, false);
		} else {
			cout << v->s << ' ';
		}
		if (ini) {
			cout << endl;
		}
	}
	
	int query(node* v, int l, int r){
		if(v->r < l || r < v->l)
			return 0;
		if(l <= v->l && v->r <= r)
			return v->s;
		int x = query(v->ll, l, r);
		int y = query(v->rr, l, r);
		return x + y;
	}
	
	int kth(node* v, int k){
		if(v->l == v->r)
			return v->l;
		if(k <= v->ll->s)
			return kth(v->ll, k);
		else
			return kth(v->rr, k - v->ll->s);
	}
	
	int Min[20][100001], Max[20][100001];
	
	int getMin(int l, int r){
		int d = __lg(r - l + 1);
		return H[Min[d][l]] < H[Min[d][r - (1 << d) + 1]] ? Min[d][l] : Min[d][r - (1 << d) + 1];
	}
	int getMax(int l, int r){
		int d = __lg(r - l + 1);
		return H[Max[d][l]] > H[Max[d][r - (1 << d) + 1]] ? Max[d][l] : Max[d][r - (1 << d) + 1];
	}
	
	void init(){
		set<pair<int, int>> T;
		set<pair<int, pair<int, int>>> S;
		active = vector<bool>(N, true);
		for(int i = 0; i < N; i++){
			if(i > 0 && i < N - 1 && ((H[i - 1] <= H[i] && H[i] <= H[i + 1]) || (H[i - 1] >= H[i] && H[i] >= H[i + 1]))) {
				active[i] = false;
				continue;
			}
			T.insert({i, H[i]});
		}
		
		if (T.size() >= 2 && (T.begin())->se > next(T.begin())->se) {
			active[T.begin()->fi] = false;
			T.erase(T.begin());
		}
		
		if (T.size() >= 2 && prev(T.end())->se > prev(prev(T.end()))->se) {
			active[prev(T.end())->fi] = false;
			T.erase(prev(T.end()));
		}
		/*
		cout << "D = 0" << endl;
		for(auto t : T){
			cout << "[" << t.fi << "] => " << t.se << endl;
		}
		*/
		ans[0] = build(0, N - 1);
		
		for(auto t = T.begin(); t != T.end(); t++){
			if(t != T.begin()) {
				S.insert({abs(t->se - prev(t)->se), {t->fi, prev(t)->fi}});
			}
		}
		
		for(int i = 0; i < N; i++) Min[0][i] = i;
		for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Min[j][i] = H[Min[j - 1][i]] < H[Min[j - 1][i + (1 << j - 1)]] ? Min[j - 1][i] : Min[j - 1][i + (1 << j - 1)];
		for(int i = 0; i < N; i++) Max[0][i] = i;
		for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Max[j][i] = H[Max[j - 1][i]] > H[Max[j - 1][i + (1 << j - 1)]] ? Max[j - 1][i] : Max[j - 1][i + (1 << j - 1)];

		node* cur = ans[0];
		while(S.size()){
			auto [d, p] = *S.begin(); S.erase(S.begin());
			
			int x = p.fi, y = p.se;
			if(!active[x] || !active[y])
				continue;
			
			active[x] = active[y] = false;

			auto ptr = T.lower_bound({x, -1});
			if(ptr != T.end() && ptr->fi == x)
				T.erase(ptr);
			
			ptr = T.lower_bound({y, -1});
			if(ptr != T.end() && ptr->fi == y)
				T.erase(ptr); 
			
			ptr = T.lower_bound({y, -1});
			if (ptr != T.begin() && ptr != T.end()) {
				S.insert({abs(ptr->se - prev(ptr)->se), {ptr->fi, prev(ptr)->fi}});
			}
			/*
			cout << "D = " << d << endl;
			for(auto t : T){
				cout << "[" << t.fi << "] => " << t.se << endl;
			}
			*/
			cur = update(cur, x, 0);
			cur = update(cur, y, 0);
			ans[d + 1] = cur;
		}
	}
	
	int query(int L, int R, int D) {
		node *root = (--ans.upper_bound(D))->se;
		int s_L = query(root, 0, L - 1);
		int s = query(root, L, R);
		
		if (s == 0) return 1;
		if (s == 1) {
			int M = kth(root, s_L + 1);
			if(L < M && M < R){
				int ML = getMin(L, M - 1); 
				int MR = getMin(M + 1, R);
				if(H[M] >= H[ML] + D && H[M] >= H[MR] + D)
					return 2;
			}
			return 1;
		}
		
		int L1 = kth(root, s_L + 1);
		int L2 = kth(root, s_L + 2);
		
		int R1 = kth(root, s_L + s);
		int R2 = kth(root, s_L + s - 1);
		
		int a = s;
		if (H[L1] > H[L2]) {
			--a;
			if(L < L1){
				int L0 = getMin(L, L1 - 1);
				if(H[L1] - H[L0] >= D){
					a += 2;
				}
			}
		}
		
		if (H[R1] > H[R2]) {
			--a;
			if(R > R1){
				int R0 = getMin(R1 + 1, R);
				if(H[R1] - H[R0] >= D){
					a += 2;
				}
			}
		} 
		return (a + 1) / 2;
	}
};

void init(int N, vector<int> H) {
	solve::N = N;
	solve::H = H;
	solve::init();
}

int max_towers(int L, int R, int D) {
	return solve::query(L, R, D);
}

Compilation message

towers.cpp: In function 'void solve::init()':
towers.cpp:127:126: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  127 |   for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Min[j][i] = H[Min[j - 1][i]] < H[Min[j - 1][i + (1 << j - 1)]] ? Min[j - 1][i] : Min[j - 1][i + (1 << j - 1)];
      |                                                                                                                            ~~^~~
towers.cpp:127:174: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  127 |   for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Min[j][i] = H[Min[j - 1][i]] < H[Min[j - 1][i + (1 << j - 1)]] ? Min[j - 1][i] : Min[j - 1][i + (1 << j - 1)];
      |                                                                                                                                                                            ~~^~~
towers.cpp:129:126: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  129 |   for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Max[j][i] = H[Max[j - 1][i]] > H[Max[j - 1][i + (1 << j - 1)]] ? Max[j - 1][i] : Max[j - 1][i + (1 << j - 1)];
      |                                                                                                                            ~~^~~
towers.cpp:129:174: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  129 |   for(int j = 1; j < 20; j++) for(int i = 0; i <= N - (1 << j); i++) Max[j][i] = H[Max[j - 1][i]] > H[Max[j - 1][i + (1 << j - 1)]] ? Max[j - 1][i] : Max[j - 1][i + (1 << j - 1)];
      |                                                                                                                                                                            ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 13724 KB Output is correct
2 Correct 697 ms 23196 KB Output is correct
3 Correct 1081 ms 23196 KB Output is correct
4 Correct 937 ms 23204 KB Output is correct
5 Correct 951 ms 23112 KB Output is correct
6 Correct 868 ms 23128 KB Output is correct
7 Correct 880 ms 23224 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 3 ms 1488 KB Output is correct
3 Correct 3 ms 1488 KB Output is correct
4 Correct 3 ms 1872 KB Output is correct
5 Correct 3 ms 1872 KB Output is correct
6 Correct 4 ms 1944 KB Output is correct
7 Correct 3 ms 1872 KB Output is correct
8 Correct 1 ms 720 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Correct 1 ms 720 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 720 KB Output is correct
14 Correct 1 ms 720 KB Output is correct
15 Correct 3 ms 1488 KB Output is correct
16 Correct 3 ms 1920 KB Output is correct
17 Correct 3 ms 1872 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 2 ms 1488 KB Output is correct
21 Correct 3 ms 1872 KB Output is correct
22 Correct 3 ms 1872 KB Output is correct
23 Correct 1 ms 720 KB Output is correct
24 Correct 1 ms 696 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1488 KB Output is correct
27 Correct 2 ms 1488 KB Output is correct
28 Correct 3 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 3 ms 1872 KB Output is correct
31 Correct 4 ms 1952 KB Output is correct
32 Correct 1 ms 720 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 3 ms 1488 KB Output is correct
3 Correct 3 ms 1488 KB Output is correct
4 Correct 3 ms 1872 KB Output is correct
5 Correct 3 ms 1872 KB Output is correct
6 Correct 4 ms 1944 KB Output is correct
7 Correct 3 ms 1872 KB Output is correct
8 Correct 1 ms 720 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Correct 1 ms 720 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 720 KB Output is correct
14 Correct 1 ms 720 KB Output is correct
15 Correct 3 ms 1488 KB Output is correct
16 Correct 3 ms 1920 KB Output is correct
17 Correct 3 ms 1872 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 2 ms 1488 KB Output is correct
21 Correct 3 ms 1872 KB Output is correct
22 Correct 3 ms 1872 KB Output is correct
23 Correct 1 ms 720 KB Output is correct
24 Correct 1 ms 696 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1488 KB Output is correct
27 Correct 2 ms 1488 KB Output is correct
28 Correct 3 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 3 ms 1872 KB Output is correct
31 Correct 4 ms 1952 KB Output is correct
32 Correct 1 ms 720 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 118 ms 51152 KB Output is correct
37 Correct 193 ms 81340 KB Output is correct
38 Correct 192 ms 81112 KB Output is correct
39 Correct 310 ms 110280 KB Output is correct
40 Correct 294 ms 110368 KB Output is correct
41 Correct 312 ms 110204 KB Output is correct
42 Correct 289 ms 110280 KB Output is correct
43 Correct 27 ms 23096 KB Output is correct
44 Correct 26 ms 23200 KB Output is correct
45 Correct 26 ms 23240 KB Output is correct
46 Correct 26 ms 23208 KB Output is correct
47 Correct 208 ms 81184 KB Output is correct
48 Correct 287 ms 110248 KB Output is correct
49 Correct 285 ms 110224 KB Output is correct
50 Correct 26 ms 23104 KB Output is correct
51 Correct 28 ms 23152 KB Output is correct
52 Correct 196 ms 81192 KB Output is correct
53 Correct 295 ms 110272 KB Output is correct
54 Correct 288 ms 110280 KB Output is correct
55 Correct 26 ms 23340 KB Output is correct
56 Correct 26 ms 23112 KB Output is correct
57 Correct 198 ms 78496 KB Output is correct
58 Correct 194 ms 81236 KB Output is correct
59 Correct 193 ms 81340 KB Output is correct
60 Correct 285 ms 110256 KB Output is correct
61 Correct 309 ms 110408 KB Output is correct
62 Correct 305 ms 110316 KB Output is correct
63 Correct 301 ms 110388 KB Output is correct
64 Correct 26 ms 23204 KB Output is correct
65 Correct 26 ms 23216 KB Output is correct
66 Correct 30 ms 23112 KB Output is correct
67 Correct 34 ms 23212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1020 ms 80576 KB Output is correct
2 Correct 1102 ms 81180 KB Output is correct
3 Correct 1105 ms 81200 KB Output is correct
4 Correct 1201 ms 110280 KB Output is correct
5 Correct 1234 ms 110276 KB Output is correct
6 Correct 1466 ms 110248 KB Output is correct
7 Correct 1480 ms 110280 KB Output is correct
8 Correct 903 ms 23100 KB Output is correct
9 Correct 919 ms 23124 KB Output is correct
10 Correct 1044 ms 23244 KB Output is correct
11 Correct 930 ms 23208 KB Output is correct
12 Correct 1022 ms 23112 KB Output is correct
13 Correct 909 ms 23204 KB Output is correct
14 Correct 0 ms 336 KB Output is correct
15 Correct 1 ms 720 KB Output is correct
16 Correct 1 ms 720 KB Output is correct
17 Correct 193 ms 81196 KB Output is correct
18 Correct 293 ms 110248 KB Output is correct
19 Correct 308 ms 110276 KB Output is correct
20 Correct 33 ms 23136 KB Output is correct
21 Correct 34 ms 23112 KB Output is correct
22 Correct 192 ms 81096 KB Output is correct
23 Correct 284 ms 110316 KB Output is correct
24 Correct 290 ms 110280 KB Output is correct
25 Correct 26 ms 23112 KB Output is correct
26 Correct 25 ms 23204 KB Output is correct
27 Correct 3 ms 1488 KB Output is correct
28 Correct 4 ms 1872 KB Output is correct
29 Correct 3 ms 1932 KB Output is correct
30 Correct 1 ms 688 KB Output is correct
31 Correct 1 ms 720 KB Output is correct
32 Correct 3 ms 1488 KB Output is correct
33 Correct 3 ms 1872 KB Output is correct
34 Correct 4 ms 1968 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 1 ms 720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 320 ms 17864 KB Output is correct
2 Correct 1219 ms 81208 KB Output is correct
3 Correct 1223 ms 81348 KB Output is correct
4 Correct 1334 ms 110228 KB Output is correct
5 Correct 1314 ms 110264 KB Output is correct
6 Correct 1386 ms 110204 KB Output is correct
7 Correct 1352 ms 110504 KB Output is correct
8 Correct 909 ms 23112 KB Output is correct
9 Correct 1041 ms 23208 KB Output is correct
10 Correct 930 ms 23212 KB Output is correct
11 Correct 861 ms 23224 KB Output is correct
12 Correct 216 ms 81192 KB Output is correct
13 Correct 288 ms 110344 KB Output is correct
14 Correct 290 ms 110308 KB Output is correct
15 Correct 27 ms 23240 KB Output is correct
16 Correct 27 ms 23112 KB Output is correct
17 Correct 192 ms 78584 KB Output is correct
18 Correct 193 ms 81272 KB Output is correct
19 Correct 214 ms 81504 KB Output is correct
20 Correct 303 ms 110236 KB Output is correct
21 Correct 296 ms 110304 KB Output is correct
22 Correct 336 ms 110244 KB Output is correct
23 Correct 309 ms 110296 KB Output is correct
24 Correct 27 ms 23212 KB Output is correct
25 Correct 28 ms 23184 KB Output is correct
26 Correct 27 ms 23108 KB Output is correct
27 Correct 29 ms 23152 KB Output is correct
28 Correct 3 ms 1488 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 4 ms 1872 KB Output is correct
31 Correct 1 ms 720 KB Output is correct
32 Correct 1 ms 720 KB Output is correct
33 Correct 1 ms 848 KB Output is correct
34 Correct 3 ms 1488 KB Output is correct
35 Correct 2 ms 1488 KB Output is correct
36 Correct 4 ms 1964 KB Output is correct
37 Correct 4 ms 1972 KB Output is correct
38 Correct 4 ms 1872 KB Output is correct
39 Correct 3 ms 1872 KB Output is correct
40 Correct 1 ms 720 KB Output is correct
41 Correct 1 ms 720 KB Output is correct
42 Correct 1 ms 720 KB Output is correct
43 Correct 1 ms 720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 3 ms 1488 KB Output is correct
3 Correct 3 ms 1488 KB Output is correct
4 Correct 3 ms 1872 KB Output is correct
5 Correct 3 ms 1872 KB Output is correct
6 Correct 4 ms 1944 KB Output is correct
7 Correct 3 ms 1872 KB Output is correct
8 Correct 1 ms 720 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Correct 1 ms 720 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 1 ms 720 KB Output is correct
14 Correct 1 ms 720 KB Output is correct
15 Correct 3 ms 1488 KB Output is correct
16 Correct 3 ms 1920 KB Output is correct
17 Correct 3 ms 1872 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 2 ms 1488 KB Output is correct
21 Correct 3 ms 1872 KB Output is correct
22 Correct 3 ms 1872 KB Output is correct
23 Correct 1 ms 720 KB Output is correct
24 Correct 1 ms 696 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Correct 3 ms 1488 KB Output is correct
27 Correct 2 ms 1488 KB Output is correct
28 Correct 3 ms 1872 KB Output is correct
29 Correct 3 ms 1872 KB Output is correct
30 Correct 3 ms 1872 KB Output is correct
31 Correct 4 ms 1952 KB Output is correct
32 Correct 1 ms 720 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 118 ms 51152 KB Output is correct
37 Correct 193 ms 81340 KB Output is correct
38 Correct 192 ms 81112 KB Output is correct
39 Correct 310 ms 110280 KB Output is correct
40 Correct 294 ms 110368 KB Output is correct
41 Correct 312 ms 110204 KB Output is correct
42 Correct 289 ms 110280 KB Output is correct
43 Correct 27 ms 23096 KB Output is correct
44 Correct 26 ms 23200 KB Output is correct
45 Correct 26 ms 23240 KB Output is correct
46 Correct 26 ms 23208 KB Output is correct
47 Correct 208 ms 81184 KB Output is correct
48 Correct 287 ms 110248 KB Output is correct
49 Correct 285 ms 110224 KB Output is correct
50 Correct 26 ms 23104 KB Output is correct
51 Correct 28 ms 23152 KB Output is correct
52 Correct 196 ms 81192 KB Output is correct
53 Correct 295 ms 110272 KB Output is correct
54 Correct 288 ms 110280 KB Output is correct
55 Correct 26 ms 23340 KB Output is correct
56 Correct 26 ms 23112 KB Output is correct
57 Correct 198 ms 78496 KB Output is correct
58 Correct 194 ms 81236 KB Output is correct
59 Correct 193 ms 81340 KB Output is correct
60 Correct 285 ms 110256 KB Output is correct
61 Correct 309 ms 110408 KB Output is correct
62 Correct 305 ms 110316 KB Output is correct
63 Correct 301 ms 110388 KB Output is correct
64 Correct 26 ms 23204 KB Output is correct
65 Correct 26 ms 23216 KB Output is correct
66 Correct 30 ms 23112 KB Output is correct
67 Correct 34 ms 23212 KB Output is correct
68 Correct 1020 ms 80576 KB Output is correct
69 Correct 1102 ms 81180 KB Output is correct
70 Correct 1105 ms 81200 KB Output is correct
71 Correct 1201 ms 110280 KB Output is correct
72 Correct 1234 ms 110276 KB Output is correct
73 Correct 1466 ms 110248 KB Output is correct
74 Correct 1480 ms 110280 KB Output is correct
75 Correct 903 ms 23100 KB Output is correct
76 Correct 919 ms 23124 KB Output is correct
77 Correct 1044 ms 23244 KB Output is correct
78 Correct 930 ms 23208 KB Output is correct
79 Correct 1022 ms 23112 KB Output is correct
80 Correct 909 ms 23204 KB Output is correct
81 Correct 0 ms 336 KB Output is correct
82 Correct 1 ms 720 KB Output is correct
83 Correct 1 ms 720 KB Output is correct
84 Correct 193 ms 81196 KB Output is correct
85 Correct 293 ms 110248 KB Output is correct
86 Correct 308 ms 110276 KB Output is correct
87 Correct 33 ms 23136 KB Output is correct
88 Correct 34 ms 23112 KB Output is correct
89 Correct 192 ms 81096 KB Output is correct
90 Correct 284 ms 110316 KB Output is correct
91 Correct 290 ms 110280 KB Output is correct
92 Correct 26 ms 23112 KB Output is correct
93 Correct 25 ms 23204 KB Output is correct
94 Correct 3 ms 1488 KB Output is correct
95 Correct 4 ms 1872 KB Output is correct
96 Correct 3 ms 1932 KB Output is correct
97 Correct 1 ms 688 KB Output is correct
98 Correct 1 ms 720 KB Output is correct
99 Correct 3 ms 1488 KB Output is correct
100 Correct 3 ms 1872 KB Output is correct
101 Correct 4 ms 1968 KB Output is correct
102 Correct 1 ms 720 KB Output is correct
103 Correct 1 ms 720 KB Output is correct
104 Correct 937 ms 71836 KB Output is correct
105 Correct 1278 ms 81056 KB Output is correct
106 Correct 1374 ms 81316 KB Output is correct
107 Correct 1339 ms 110276 KB Output is correct
108 Correct 1534 ms 110408 KB Output is correct
109 Correct 1472 ms 110260 KB Output is correct
110 Correct 1219 ms 110264 KB Output is correct
111 Correct 957 ms 23208 KB Output is correct
112 Correct 1016 ms 23112 KB Output is correct
113 Correct 857 ms 23112 KB Output is correct
114 Correct 916 ms 23200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 13724 KB Output is correct
2 Correct 697 ms 23196 KB Output is correct
3 Correct 1081 ms 23196 KB Output is correct
4 Correct 937 ms 23204 KB Output is correct
5 Correct 951 ms 23112 KB Output is correct
6 Correct 868 ms 23128 KB Output is correct
7 Correct 880 ms 23224 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 3 ms 1488 KB Output is correct
13 Correct 3 ms 1488 KB Output is correct
14 Correct 3 ms 1872 KB Output is correct
15 Correct 3 ms 1872 KB Output is correct
16 Correct 4 ms 1944 KB Output is correct
17 Correct 3 ms 1872 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 1 ms 720 KB Output is correct
21 Correct 1 ms 720 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 1 ms 720 KB Output is correct
24 Correct 1 ms 720 KB Output is correct
25 Correct 3 ms 1488 KB Output is correct
26 Correct 3 ms 1920 KB Output is correct
27 Correct 3 ms 1872 KB Output is correct
28 Correct 1 ms 720 KB Output is correct
29 Correct 1 ms 720 KB Output is correct
30 Correct 2 ms 1488 KB Output is correct
31 Correct 3 ms 1872 KB Output is correct
32 Correct 3 ms 1872 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 1 ms 696 KB Output is correct
35 Correct 1 ms 848 KB Output is correct
36 Correct 3 ms 1488 KB Output is correct
37 Correct 2 ms 1488 KB Output is correct
38 Correct 3 ms 1872 KB Output is correct
39 Correct 3 ms 1872 KB Output is correct
40 Correct 3 ms 1872 KB Output is correct
41 Correct 4 ms 1952 KB Output is correct
42 Correct 1 ms 720 KB Output is correct
43 Correct 1 ms 720 KB Output is correct
44 Correct 1 ms 720 KB Output is correct
45 Correct 1 ms 720 KB Output is correct
46 Correct 118 ms 51152 KB Output is correct
47 Correct 193 ms 81340 KB Output is correct
48 Correct 192 ms 81112 KB Output is correct
49 Correct 310 ms 110280 KB Output is correct
50 Correct 294 ms 110368 KB Output is correct
51 Correct 312 ms 110204 KB Output is correct
52 Correct 289 ms 110280 KB Output is correct
53 Correct 27 ms 23096 KB Output is correct
54 Correct 26 ms 23200 KB Output is correct
55 Correct 26 ms 23240 KB Output is correct
56 Correct 26 ms 23208 KB Output is correct
57 Correct 208 ms 81184 KB Output is correct
58 Correct 287 ms 110248 KB Output is correct
59 Correct 285 ms 110224 KB Output is correct
60 Correct 26 ms 23104 KB Output is correct
61 Correct 28 ms 23152 KB Output is correct
62 Correct 196 ms 81192 KB Output is correct
63 Correct 295 ms 110272 KB Output is correct
64 Correct 288 ms 110280 KB Output is correct
65 Correct 26 ms 23340 KB Output is correct
66 Correct 26 ms 23112 KB Output is correct
67 Correct 198 ms 78496 KB Output is correct
68 Correct 194 ms 81236 KB Output is correct
69 Correct 193 ms 81340 KB Output is correct
70 Correct 285 ms 110256 KB Output is correct
71 Correct 309 ms 110408 KB Output is correct
72 Correct 305 ms 110316 KB Output is correct
73 Correct 301 ms 110388 KB Output is correct
74 Correct 26 ms 23204 KB Output is correct
75 Correct 26 ms 23216 KB Output is correct
76 Correct 30 ms 23112 KB Output is correct
77 Correct 34 ms 23212 KB Output is correct
78 Correct 1020 ms 80576 KB Output is correct
79 Correct 1102 ms 81180 KB Output is correct
80 Correct 1105 ms 81200 KB Output is correct
81 Correct 1201 ms 110280 KB Output is correct
82 Correct 1234 ms 110276 KB Output is correct
83 Correct 1466 ms 110248 KB Output is correct
84 Correct 1480 ms 110280 KB Output is correct
85 Correct 903 ms 23100 KB Output is correct
86 Correct 919 ms 23124 KB Output is correct
87 Correct 1044 ms 23244 KB Output is correct
88 Correct 930 ms 23208 KB Output is correct
89 Correct 1022 ms 23112 KB Output is correct
90 Correct 909 ms 23204 KB Output is correct
91 Correct 0 ms 336 KB Output is correct
92 Correct 1 ms 720 KB Output is correct
93 Correct 1 ms 720 KB Output is correct
94 Correct 193 ms 81196 KB Output is correct
95 Correct 293 ms 110248 KB Output is correct
96 Correct 308 ms 110276 KB Output is correct
97 Correct 33 ms 23136 KB Output is correct
98 Correct 34 ms 23112 KB Output is correct
99 Correct 192 ms 81096 KB Output is correct
100 Correct 284 ms 110316 KB Output is correct
101 Correct 290 ms 110280 KB Output is correct
102 Correct 26 ms 23112 KB Output is correct
103 Correct 25 ms 23204 KB Output is correct
104 Correct 3 ms 1488 KB Output is correct
105 Correct 4 ms 1872 KB Output is correct
106 Correct 3 ms 1932 KB Output is correct
107 Correct 1 ms 688 KB Output is correct
108 Correct 1 ms 720 KB Output is correct
109 Correct 3 ms 1488 KB Output is correct
110 Correct 3 ms 1872 KB Output is correct
111 Correct 4 ms 1968 KB Output is correct
112 Correct 1 ms 720 KB Output is correct
113 Correct 1 ms 720 KB Output is correct
114 Correct 320 ms 17864 KB Output is correct
115 Correct 1219 ms 81208 KB Output is correct
116 Correct 1223 ms 81348 KB Output is correct
117 Correct 1334 ms 110228 KB Output is correct
118 Correct 1314 ms 110264 KB Output is correct
119 Correct 1386 ms 110204 KB Output is correct
120 Correct 1352 ms 110504 KB Output is correct
121 Correct 909 ms 23112 KB Output is correct
122 Correct 1041 ms 23208 KB Output is correct
123 Correct 930 ms 23212 KB Output is correct
124 Correct 861 ms 23224 KB Output is correct
125 Correct 216 ms 81192 KB Output is correct
126 Correct 288 ms 110344 KB Output is correct
127 Correct 290 ms 110308 KB Output is correct
128 Correct 27 ms 23240 KB Output is correct
129 Correct 27 ms 23112 KB Output is correct
130 Correct 192 ms 78584 KB Output is correct
131 Correct 193 ms 81272 KB Output is correct
132 Correct 214 ms 81504 KB Output is correct
133 Correct 303 ms 110236 KB Output is correct
134 Correct 296 ms 110304 KB Output is correct
135 Correct 336 ms 110244 KB Output is correct
136 Correct 309 ms 110296 KB Output is correct
137 Correct 27 ms 23212 KB Output is correct
138 Correct 28 ms 23184 KB Output is correct
139 Correct 27 ms 23108 KB Output is correct
140 Correct 29 ms 23152 KB Output is correct
141 Correct 3 ms 1488 KB Output is correct
142 Correct 3 ms 1872 KB Output is correct
143 Correct 4 ms 1872 KB Output is correct
144 Correct 1 ms 720 KB Output is correct
145 Correct 1 ms 720 KB Output is correct
146 Correct 1 ms 848 KB Output is correct
147 Correct 3 ms 1488 KB Output is correct
148 Correct 2 ms 1488 KB Output is correct
149 Correct 4 ms 1964 KB Output is correct
150 Correct 4 ms 1972 KB Output is correct
151 Correct 4 ms 1872 KB Output is correct
152 Correct 3 ms 1872 KB Output is correct
153 Correct 1 ms 720 KB Output is correct
154 Correct 1 ms 720 KB Output is correct
155 Correct 1 ms 720 KB Output is correct
156 Correct 1 ms 720 KB Output is correct
157 Correct 937 ms 71836 KB Output is correct
158 Correct 1278 ms 81056 KB Output is correct
159 Correct 1374 ms 81316 KB Output is correct
160 Correct 1339 ms 110276 KB Output is correct
161 Correct 1534 ms 110408 KB Output is correct
162 Correct 1472 ms 110260 KB Output is correct
163 Correct 1219 ms 110264 KB Output is correct
164 Correct 957 ms 23208 KB Output is correct
165 Correct 1016 ms 23112 KB Output is correct
166 Correct 857 ms 23112 KB Output is correct
167 Correct 916 ms 23200 KB Output is correct
168 Correct 0 ms 336 KB Output is correct
169 Correct 886 ms 26376 KB Output is correct
170 Correct 1736 ms 80876 KB Output is correct
171 Correct 1503 ms 81016 KB Output is correct
172 Correct 1716 ms 110256 KB Output is correct
173 Correct 1833 ms 110220 KB Output is correct
174 Correct 1704 ms 110264 KB Output is correct
175 Correct 1715 ms 110364 KB Output is correct
176 Correct 1028 ms 23208 KB Output is correct
177 Correct 1004 ms 23112 KB Output is correct
178 Correct 827 ms 23208 KB Output is correct
179 Correct 1058 ms 23112 KB Output is correct