답안 #763574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763574 2023-06-22T13:10:36 Z amunduzbaev 송신탑 (IOI22_towers) C++17
100 / 100
1604 ms 144620 KB
#include "towers.h"
 
#include "bits/stdc++.h"
using namespace std;
 
#ifndef EVAL
#include "stub.cpp"
#endif
 
#define ar array
typedef int64_t ll;
//~ #define int ll
 
const int inf = 1e9 + 7;
const int N = 1e5 + 5;
const int B = 320;
//~ int first, mount;
//~ vector<int> a, l, r, res;
vector<ar<int, 2>> res;
vector<int> a, tot;
 
struct STMx{
	vector<int> tree;
	int N;
	
	STMx(int N): N(N){
		tree.resize(N << 2);
	}
	
	void set(int i, int v, int lx, int rx, int x){
		if(lx == rx){
			tree[x] = v;
			return;
		}
		
		int m = (lx + rx) >> 1;
		if(i <= m) set(i, v, lx, m, x << 1);
		else set(i, v, m + 1, rx, x << 1 | 1);
		tree[x] = max(tree[x << 1], tree[x << 1 | 1]);
	}
	
	void set(int i, int v){
		set(i, v, 0, N, 1);
	}
	
	int get(int l, int r, int lx, int rx, int x){
		if(lx > r || rx < l){
			return 0;
		}
		if(lx >= l && rx <= r){
			return tree[x];
		}
		int m = (lx + rx) >> 1;
		return max(get(l, r, lx, m, x << 1), get(l, r, m + 1, rx, x << 1 | 1));
	}
	
	int get(int l, int r){
		return get(l, r, 0, N, 1);
	}
	
	int first(int l, int r, int v, int lx, int rx, int x){
		if(lx > r || rx < l) return -1;
		if(lx >= l && rx <= r){
			if(tree[x] < v) return -1;
			if(lx == rx) return lx;
			int m = (lx + rx) >> 1;
			if(tree[x << 1] >= v) return first(l, r, v, lx, m, x << 1);
			else return first(l, r, v, m + 1, rx, x << 1 | 1);
		}
		int m = (lx + rx) >> 1;
		int res = first(l, r, v, lx, m, x << 1);
		if(res == -1) res = first(l, r, v, m + 1, rx, x << 1 | 1);
		return res;
	}
	
	int first(int l, int r, int v){
		return first(l, r, v, 0, N, 1);
	}
	
	int last(int l, int r, int v, int lx, int rx, int x){
		if(lx > r || rx < l) return -1;
		if(lx >= l && rx <= r){
			if(tree[x] < v) return -1;
			if(lx == rx) return lx;
			int m = (lx + rx) >> 1;
			if(tree[x << 1 | 1] >= v) return last(l, r, v, m + 1, rx, x << 1 | 1);
			else return last(l, r, v, lx, m, x << 1);
		}
		
		int m = (lx + rx) >> 1;
		int res = last(l, r, v, m + 1, rx, x << 1 | 1);
		if(res == -1) res = last(l, r, v, lx, m, x << 1);
		return res;
	}
	
	int last(int l, int r, int v){
		return last(l, r, v, 0, N, 1);
	}
}Max(N), DMax(N);
     
struct ST{
	vector<int> Max, Min, t01, t10;
	int N;
	
	ST(int N): N(N){
		Max.resize(N << 2);
		Min.resize(N << 2);
		t01.resize(N << 2);
		t10.resize(N << 2);
	}
	
	void set(int i, int v, int lx, int rx, int x){
		if(lx == rx){
			t01[x] = t10[x] = 0;
			Max[x] = Min[x] = v;
			return;
		}
		
		int m = (lx + rx) >> 1;
		if(i <= m) set(i, v, lx, m, x << 1);
		else set(i, v, m + 1, rx, x << 1 | 1);
		
		t01[x] = max({t01[x << 1], t01[x << 1 | 1], Max[x << 1 | 1] - Min[x << 1]});
		t10[x] = max({t10[x << 1], t10[x << 1 | 1], Max[x << 1] - Min[x << 1 | 1]});
		Max[x] = max(Max[x << 1], Max[x << 1 | 1]);
		Min[x] = min(Min[x << 1], Min[x << 1 | 1]);
	}
	
	void set(int i, int v){
		set(i, v, 0, N, 1);
	}
	
	int mn, mx;
	int get01(int l, int r, int d, int lx, int rx, int x){
		if(lx > r || rx < l){
			return -1;
		}
		if(lx >= l && rx <= r){
			if(t01[x] < d && Max[x] - mn < d){
				mn = min(mn, Min[x]);
				return -1;
			}
			if(lx == rx) return lx;
			int m = (lx + rx) >> 1;
			if(Max[x << 1] - mn >= d || t01[x << 1] >= d){
				return get01(l, r, d, lx, m, x << 1);
			} else {
				mn = min(mn, Min[x << 1]);
				return get01(l, r, d, m + 1, rx, x << 1 | 1);
			}
		}
		int m = (lx + rx) >> 1;
		int res = get01(l, r, d, lx, m, x << 1);
		if(res == -1) res = get01(l, r, d, m + 1, rx, x << 1 | 1);
		
		return res;
	}
	
	int get01(int l, int r, int d){
		mn = inf;
		return get01(l, r, d, 0, N, 1);
	}
	
	int get10(int l, int r, int d, int lx, int rx, int x){
		if(lx > r || rx < l){
			return -1;
		}
		
		if(lx >= l && rx <= r){
			if(t10[x] < d && Max[x] - mn < d){
				mn = min(mn, Min[x]);
				return -1;
			}
			if(lx == rx) return lx;
			int m = (lx + rx) >> 1;
			if(Max[x << 1 | 1] - mn >= d || t10[x << 1 | 1] >= d){
				return get10(l, r, d, m + 1, rx, x << 1 | 1);
			} else {
				mn = min(mn, Min[x << 1 | 1]);
				return get10(l, r, d, lx, m, x << 1);
			}
		}
		
		int m = (lx + rx) >> 1;
		int res = get10(l, r, d, m + 1, rx, x << 1 | 1);
		if(res == -1) res = get10(l, r, d, lx, m, x << 1);
		
		return res;
	}
	
	int get10(int l, int r, int d){
		mn = inf;
		return get10(l, r, d, 0, N, 1);
	}
}tree(N);
 
vector<int> v;

int cnt[B][N];
 
struct sqD{
	int a[N];
	
	sqD(){
		memset(cnt, 0, sizeof cnt);
		memset(a, 0, sizeof a);
	}
	
	void set(int i, int v){
		a[i] = v;
		cnt[i / B][a[i]]++;
	}
	
	void build(){
		for(int i=0;i<B;i++){
			for(int j=N-2;~j;j--){
				cnt[i][j] += cnt[i][j + 1];
			}
		}
	}
	
	int get(int l, int r, int d){
		int l_ = l / B, r_ = r / B;
		
		int res = 0;
		for(int j=l_+1;j<r_;j++){
			res += cnt[j][d];
		}
		
		if(l_ == r_){
			for(int i=l;i<=r;i++) res += (a[i] >= d);
		} else {
			for(int i=l;i<(l_ + 1) * B;i++) res += (a[i] >= d);
			for(int i=r_ * B;i <= r;i++) res += (a[i] >= d);
		}
		
		return res;
	}
}block;

void init(int n, vector<int> h) {
	a = h;
	vector<int> pos;
	for(int i=0;i<n;i++){
		Max.set(i, a[i]);
		if((!i || a[i] < a[i - 1]) && (i + 1 == n || a[i] < a[i + 1])){
			pos.push_back(i);
		}
	}
	
	set<int> ss;
	multiset<ar<int, 2>> dif;
	
	for(int i=0;i<(int)pos.size();i++){
		if(i){
			int mx = Max.get(pos[i - 1], pos[i]);
			dif.insert({mx - a[pos[i - 1]], pos[i - 1]});
			dif.insert({mx - a[pos[i]], pos[i]});
		}
		ss.insert(pos[i]);
	}
	
	while(!dif.empty()){
		auto [d, i] = *dif.begin();
		res.push_back({d, i});
		
		//~ cout<<i<<" "<<d<<"\n";
		auto it = ss.lower_bound(i);
		auto R = it; R++;
		if(it == ss.begin() || R == ss.end()){
			if(it == ss.begin()){
				int mx = Max.get(*it, *R);
				dif.erase(dif.find({mx - a[*it], *it}));
				dif.erase(dif.find({mx - a[*R], *R}));
			} else {
				auto L = it; L--;
				int mx = Max.get(*L, *it);
				dif.erase(dif.find({mx - a[*it], *it}));
				dif.erase(dif.find({mx - a[*L], *L}));
			}
			ss.erase(it);
			continue;
		}
		
		auto L = it; --L;
		
		int mx = Max.get(*L, *it);
		dif.erase(dif.find({mx - a[*it], *it}));
		dif.erase(dif.find({mx - a[*L], *L}));
		
		mx = Max.get(*it, *R);
		dif.erase(dif.find({mx - a[*it], *it}));
		dif.erase(dif.find({mx - a[*R], *R}));
		
		mx = Max.get(*L, *R);
		dif.insert({mx - a[*L], *L});
		dif.insert({mx - a[*R], *R});
		
		ss.erase(it);
	}
	res.push_back({inf, *ss.begin()});
	for(auto x : res) tot.push_back(x[0]);
	tot.erase(unique(tot.begin(), tot.end()), tot.end());
	v.resize(n);
	
	for(auto [d, i] : res){
		v[i] = lower_bound(tot.begin(), tot.end(), d) - tot.begin() + 1;
	}
	
	for(int i=0;i<n;i++){
		tree.set(i, a[i]);
		DMax.set(i, v[i]);
		assert(v[i] <= N);
		block.set(i, v[i]);
	}
	
	block.build();
}
 
int max_towers(int l, int r, int d) {
	int D = lower_bound(tot.begin(), tot.end(), d) - tot.begin() + 1;
	int n = a.size();
	
	auto get = [&](int l, int r, int d){
		int res = 0;
		for(int i=l;i<=r;i++){
			if(v[i] >= d) res++;
		}
		
		return res;
	};
	//~ int res = get(l, r, D);
	int res = block.get(l, r, D);
	
	if(!res){
		int l_ = tree.get01(l, r, d), r_ = tree.get10(l, r, d);
		if(~l_ && ~r_ && l_ <= r_){
			return 2;
		}
		
		return 1;
	}
	
	int l_ = DMax.first(l, r, D), r_ = DMax.last(l, r, D);
	assert(~l_ && ~r_);
	l_ = Max.last(l, l_, a[l_] + d);
	r_ = Max.first(r_, r, a[r_] + d);
	
	if(~l_ && ~tree.get01(l, l_, d)){
		res++;
	}
	if(~r_ && ~tree.get10(r_, r, d)){
		res++;
	}
	
	return res;
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:322:6: warning: unused variable 'n' [-Wunused-variable]
  322 |  int n = a.size();
      |      ^
towers.cpp:324:7: warning: variable 'get' set but not used [-Wunused-but-set-variable]
  324 |  auto get = [&](int l, int r, int d){
      |       ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 560 ms 136224 KB Output is correct
2 Correct 1010 ms 136840 KB Output is correct
3 Correct 947 ms 136868 KB Output is correct
4 Correct 906 ms 136844 KB Output is correct
5 Correct 989 ms 136896 KB Output is correct
6 Correct 1006 ms 136804 KB Output is correct
7 Correct 989 ms 136808 KB Output is correct
8 Correct 120 ms 135300 KB Output is correct
9 Correct 118 ms 135236 KB Output is correct
10 Correct 125 ms 135360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 135256 KB Output is correct
2 Correct 124 ms 135464 KB Output is correct
3 Correct 120 ms 135476 KB Output is correct
4 Correct 122 ms 135468 KB Output is correct
5 Correct 128 ms 135552 KB Output is correct
6 Correct 120 ms 135520 KB Output is correct
7 Correct 119 ms 135516 KB Output is correct
8 Correct 119 ms 135368 KB Output is correct
9 Correct 123 ms 135364 KB Output is correct
10 Correct 125 ms 135244 KB Output is correct
11 Correct 119 ms 135316 KB Output is correct
12 Correct 120 ms 135240 KB Output is correct
13 Correct 119 ms 135376 KB Output is correct
14 Correct 120 ms 135548 KB Output is correct
15 Correct 122 ms 135468 KB Output is correct
16 Correct 120 ms 135456 KB Output is correct
17 Correct 127 ms 135516 KB Output is correct
18 Correct 119 ms 135356 KB Output is correct
19 Correct 126 ms 135364 KB Output is correct
20 Correct 122 ms 135368 KB Output is correct
21 Correct 122 ms 135512 KB Output is correct
22 Correct 120 ms 135476 KB Output is correct
23 Correct 121 ms 135364 KB Output is correct
24 Correct 121 ms 135360 KB Output is correct
25 Correct 118 ms 135420 KB Output is correct
26 Correct 126 ms 135468 KB Output is correct
27 Correct 122 ms 135464 KB Output is correct
28 Correct 121 ms 135508 KB Output is correct
29 Correct 116 ms 135504 KB Output is correct
30 Correct 116 ms 135516 KB Output is correct
31 Correct 116 ms 135512 KB Output is correct
32 Correct 117 ms 135368 KB Output is correct
33 Correct 113 ms 135352 KB Output is correct
34 Correct 116 ms 135264 KB Output is correct
35 Correct 119 ms 135240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 135256 KB Output is correct
2 Correct 124 ms 135464 KB Output is correct
3 Correct 120 ms 135476 KB Output is correct
4 Correct 122 ms 135468 KB Output is correct
5 Correct 128 ms 135552 KB Output is correct
6 Correct 120 ms 135520 KB Output is correct
7 Correct 119 ms 135516 KB Output is correct
8 Correct 119 ms 135368 KB Output is correct
9 Correct 123 ms 135364 KB Output is correct
10 Correct 125 ms 135244 KB Output is correct
11 Correct 119 ms 135316 KB Output is correct
12 Correct 120 ms 135240 KB Output is correct
13 Correct 119 ms 135376 KB Output is correct
14 Correct 120 ms 135548 KB Output is correct
15 Correct 122 ms 135468 KB Output is correct
16 Correct 120 ms 135456 KB Output is correct
17 Correct 127 ms 135516 KB Output is correct
18 Correct 119 ms 135356 KB Output is correct
19 Correct 126 ms 135364 KB Output is correct
20 Correct 122 ms 135368 KB Output is correct
21 Correct 122 ms 135512 KB Output is correct
22 Correct 120 ms 135476 KB Output is correct
23 Correct 121 ms 135364 KB Output is correct
24 Correct 121 ms 135360 KB Output is correct
25 Correct 118 ms 135420 KB Output is correct
26 Correct 126 ms 135468 KB Output is correct
27 Correct 122 ms 135464 KB Output is correct
28 Correct 121 ms 135508 KB Output is correct
29 Correct 116 ms 135504 KB Output is correct
30 Correct 116 ms 135516 KB Output is correct
31 Correct 116 ms 135512 KB Output is correct
32 Correct 117 ms 135368 KB Output is correct
33 Correct 113 ms 135352 KB Output is correct
34 Correct 116 ms 135264 KB Output is correct
35 Correct 119 ms 135240 KB Output is correct
36 Correct 224 ms 139564 KB Output is correct
37 Correct 264 ms 141888 KB Output is correct
38 Correct 265 ms 142048 KB Output is correct
39 Correct 324 ms 144492 KB Output is correct
40 Correct 360 ms 144456 KB Output is correct
41 Correct 296 ms 144460 KB Output is correct
42 Correct 311 ms 144436 KB Output is correct
43 Correct 158 ms 136892 KB Output is correct
44 Correct 182 ms 136896 KB Output is correct
45 Correct 160 ms 136828 KB Output is correct
46 Correct 166 ms 136908 KB Output is correct
47 Correct 256 ms 142088 KB Output is correct
48 Correct 301 ms 144404 KB Output is correct
49 Correct 310 ms 144452 KB Output is correct
50 Correct 172 ms 136896 KB Output is correct
51 Correct 153 ms 136908 KB Output is correct
52 Correct 257 ms 142076 KB Output is correct
53 Correct 320 ms 144484 KB Output is correct
54 Correct 315 ms 144404 KB Output is correct
55 Correct 164 ms 136900 KB Output is correct
56 Correct 167 ms 136900 KB Output is correct
57 Correct 254 ms 141496 KB Output is correct
58 Correct 266 ms 141984 KB Output is correct
59 Correct 251 ms 141952 KB Output is correct
60 Correct 339 ms 144476 KB Output is correct
61 Correct 327 ms 144532 KB Output is correct
62 Correct 305 ms 144432 KB Output is correct
63 Correct 336 ms 144484 KB Output is correct
64 Correct 159 ms 136900 KB Output is correct
65 Correct 163 ms 136904 KB Output is correct
66 Correct 159 ms 136784 KB Output is correct
67 Correct 158 ms 136904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 876 ms 141956 KB Output is correct
2 Correct 1123 ms 141992 KB Output is correct
3 Correct 1389 ms 142092 KB Output is correct
4 Correct 1066 ms 144496 KB Output is correct
5 Correct 1290 ms 144504 KB Output is correct
6 Correct 1327 ms 144424 KB Output is correct
7 Correct 1028 ms 144492 KB Output is correct
8 Correct 831 ms 136912 KB Output is correct
9 Correct 887 ms 136908 KB Output is correct
10 Correct 916 ms 136904 KB Output is correct
11 Correct 1125 ms 136900 KB Output is correct
12 Correct 1113 ms 136900 KB Output is correct
13 Correct 1067 ms 136900 KB Output is correct
14 Correct 129 ms 135328 KB Output is correct
15 Correct 119 ms 135336 KB Output is correct
16 Correct 120 ms 135360 KB Output is correct
17 Correct 252 ms 142096 KB Output is correct
18 Correct 335 ms 144516 KB Output is correct
19 Correct 316 ms 144412 KB Output is correct
20 Correct 166 ms 136896 KB Output is correct
21 Correct 161 ms 136896 KB Output is correct
22 Correct 269 ms 142020 KB Output is correct
23 Correct 375 ms 144508 KB Output is correct
24 Correct 314 ms 144476 KB Output is correct
25 Correct 160 ms 136896 KB Output is correct
26 Correct 167 ms 136908 KB Output is correct
27 Correct 122 ms 135372 KB Output is correct
28 Correct 131 ms 135516 KB Output is correct
29 Correct 123 ms 135468 KB Output is correct
30 Correct 123 ms 135304 KB Output is correct
31 Correct 120 ms 135364 KB Output is correct
32 Correct 121 ms 135460 KB Output is correct
33 Correct 122 ms 135516 KB Output is correct
34 Correct 120 ms 135532 KB Output is correct
35 Correct 118 ms 135240 KB Output is correct
36 Correct 125 ms 135368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 463 ms 136900 KB Output is correct
2 Correct 1464 ms 142028 KB Output is correct
3 Correct 1523 ms 142032 KB Output is correct
4 Correct 1513 ms 144620 KB Output is correct
5 Correct 1604 ms 144596 KB Output is correct
6 Correct 1593 ms 144520 KB Output is correct
7 Correct 1582 ms 144528 KB Output is correct
8 Correct 995 ms 136900 KB Output is correct
9 Correct 1006 ms 136912 KB Output is correct
10 Correct 1002 ms 136900 KB Output is correct
11 Correct 963 ms 136872 KB Output is correct
12 Correct 271 ms 142312 KB Output is correct
13 Correct 309 ms 144484 KB Output is correct
14 Correct 306 ms 144484 KB Output is correct
15 Correct 160 ms 136904 KB Output is correct
16 Correct 159 ms 136828 KB Output is correct
17 Correct 248 ms 141520 KB Output is correct
18 Correct 259 ms 141968 KB Output is correct
19 Correct 289 ms 141952 KB Output is correct
20 Correct 332 ms 144572 KB Output is correct
21 Correct 312 ms 144428 KB Output is correct
22 Correct 328 ms 144436 KB Output is correct
23 Correct 305 ms 144516 KB Output is correct
24 Correct 172 ms 136876 KB Output is correct
25 Correct 162 ms 137008 KB Output is correct
26 Correct 167 ms 136872 KB Output is correct
27 Correct 159 ms 136900 KB Output is correct
28 Correct 121 ms 135464 KB Output is correct
29 Correct 124 ms 135572 KB Output is correct
30 Correct 122 ms 135512 KB Output is correct
31 Correct 121 ms 135288 KB Output is correct
32 Correct 120 ms 135360 KB Output is correct
33 Correct 120 ms 135344 KB Output is correct
34 Correct 121 ms 135476 KB Output is correct
35 Correct 123 ms 135368 KB Output is correct
36 Correct 122 ms 135492 KB Output is correct
37 Correct 122 ms 135496 KB Output is correct
38 Correct 123 ms 135580 KB Output is correct
39 Correct 122 ms 135512 KB Output is correct
40 Correct 129 ms 135360 KB Output is correct
41 Correct 120 ms 135292 KB Output is correct
42 Correct 120 ms 135268 KB Output is correct
43 Correct 122 ms 135368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 135256 KB Output is correct
2 Correct 124 ms 135464 KB Output is correct
3 Correct 120 ms 135476 KB Output is correct
4 Correct 122 ms 135468 KB Output is correct
5 Correct 128 ms 135552 KB Output is correct
6 Correct 120 ms 135520 KB Output is correct
7 Correct 119 ms 135516 KB Output is correct
8 Correct 119 ms 135368 KB Output is correct
9 Correct 123 ms 135364 KB Output is correct
10 Correct 125 ms 135244 KB Output is correct
11 Correct 119 ms 135316 KB Output is correct
12 Correct 120 ms 135240 KB Output is correct
13 Correct 119 ms 135376 KB Output is correct
14 Correct 120 ms 135548 KB Output is correct
15 Correct 122 ms 135468 KB Output is correct
16 Correct 120 ms 135456 KB Output is correct
17 Correct 127 ms 135516 KB Output is correct
18 Correct 119 ms 135356 KB Output is correct
19 Correct 126 ms 135364 KB Output is correct
20 Correct 122 ms 135368 KB Output is correct
21 Correct 122 ms 135512 KB Output is correct
22 Correct 120 ms 135476 KB Output is correct
23 Correct 121 ms 135364 KB Output is correct
24 Correct 121 ms 135360 KB Output is correct
25 Correct 118 ms 135420 KB Output is correct
26 Correct 126 ms 135468 KB Output is correct
27 Correct 122 ms 135464 KB Output is correct
28 Correct 121 ms 135508 KB Output is correct
29 Correct 116 ms 135504 KB Output is correct
30 Correct 116 ms 135516 KB Output is correct
31 Correct 116 ms 135512 KB Output is correct
32 Correct 117 ms 135368 KB Output is correct
33 Correct 113 ms 135352 KB Output is correct
34 Correct 116 ms 135264 KB Output is correct
35 Correct 119 ms 135240 KB Output is correct
36 Correct 224 ms 139564 KB Output is correct
37 Correct 264 ms 141888 KB Output is correct
38 Correct 265 ms 142048 KB Output is correct
39 Correct 324 ms 144492 KB Output is correct
40 Correct 360 ms 144456 KB Output is correct
41 Correct 296 ms 144460 KB Output is correct
42 Correct 311 ms 144436 KB Output is correct
43 Correct 158 ms 136892 KB Output is correct
44 Correct 182 ms 136896 KB Output is correct
45 Correct 160 ms 136828 KB Output is correct
46 Correct 166 ms 136908 KB Output is correct
47 Correct 256 ms 142088 KB Output is correct
48 Correct 301 ms 144404 KB Output is correct
49 Correct 310 ms 144452 KB Output is correct
50 Correct 172 ms 136896 KB Output is correct
51 Correct 153 ms 136908 KB Output is correct
52 Correct 257 ms 142076 KB Output is correct
53 Correct 320 ms 144484 KB Output is correct
54 Correct 315 ms 144404 KB Output is correct
55 Correct 164 ms 136900 KB Output is correct
56 Correct 167 ms 136900 KB Output is correct
57 Correct 254 ms 141496 KB Output is correct
58 Correct 266 ms 141984 KB Output is correct
59 Correct 251 ms 141952 KB Output is correct
60 Correct 339 ms 144476 KB Output is correct
61 Correct 327 ms 144532 KB Output is correct
62 Correct 305 ms 144432 KB Output is correct
63 Correct 336 ms 144484 KB Output is correct
64 Correct 159 ms 136900 KB Output is correct
65 Correct 163 ms 136904 KB Output is correct
66 Correct 159 ms 136784 KB Output is correct
67 Correct 158 ms 136904 KB Output is correct
68 Correct 876 ms 141956 KB Output is correct
69 Correct 1123 ms 141992 KB Output is correct
70 Correct 1389 ms 142092 KB Output is correct
71 Correct 1066 ms 144496 KB Output is correct
72 Correct 1290 ms 144504 KB Output is correct
73 Correct 1327 ms 144424 KB Output is correct
74 Correct 1028 ms 144492 KB Output is correct
75 Correct 831 ms 136912 KB Output is correct
76 Correct 887 ms 136908 KB Output is correct
77 Correct 916 ms 136904 KB Output is correct
78 Correct 1125 ms 136900 KB Output is correct
79 Correct 1113 ms 136900 KB Output is correct
80 Correct 1067 ms 136900 KB Output is correct
81 Correct 129 ms 135328 KB Output is correct
82 Correct 119 ms 135336 KB Output is correct
83 Correct 120 ms 135360 KB Output is correct
84 Correct 252 ms 142096 KB Output is correct
85 Correct 335 ms 144516 KB Output is correct
86 Correct 316 ms 144412 KB Output is correct
87 Correct 166 ms 136896 KB Output is correct
88 Correct 161 ms 136896 KB Output is correct
89 Correct 269 ms 142020 KB Output is correct
90 Correct 375 ms 144508 KB Output is correct
91 Correct 314 ms 144476 KB Output is correct
92 Correct 160 ms 136896 KB Output is correct
93 Correct 167 ms 136908 KB Output is correct
94 Correct 122 ms 135372 KB Output is correct
95 Correct 131 ms 135516 KB Output is correct
96 Correct 123 ms 135468 KB Output is correct
97 Correct 123 ms 135304 KB Output is correct
98 Correct 120 ms 135364 KB Output is correct
99 Correct 121 ms 135460 KB Output is correct
100 Correct 122 ms 135516 KB Output is correct
101 Correct 120 ms 135532 KB Output is correct
102 Correct 118 ms 135240 KB Output is correct
103 Correct 125 ms 135368 KB Output is correct
104 Correct 1004 ms 141024 KB Output is correct
105 Correct 1168 ms 142080 KB Output is correct
106 Correct 1082 ms 141940 KB Output is correct
107 Correct 1223 ms 144480 KB Output is correct
108 Correct 1395 ms 144516 KB Output is correct
109 Correct 1300 ms 144472 KB Output is correct
110 Correct 1266 ms 144440 KB Output is correct
111 Correct 1087 ms 136912 KB Output is correct
112 Correct 1104 ms 136900 KB Output is correct
113 Correct 1018 ms 137016 KB Output is correct
114 Correct 988 ms 136904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 560 ms 136224 KB Output is correct
2 Correct 1010 ms 136840 KB Output is correct
3 Correct 947 ms 136868 KB Output is correct
4 Correct 906 ms 136844 KB Output is correct
5 Correct 989 ms 136896 KB Output is correct
6 Correct 1006 ms 136804 KB Output is correct
7 Correct 989 ms 136808 KB Output is correct
8 Correct 120 ms 135300 KB Output is correct
9 Correct 118 ms 135236 KB Output is correct
10 Correct 125 ms 135360 KB Output is correct
11 Correct 119 ms 135256 KB Output is correct
12 Correct 124 ms 135464 KB Output is correct
13 Correct 120 ms 135476 KB Output is correct
14 Correct 122 ms 135468 KB Output is correct
15 Correct 128 ms 135552 KB Output is correct
16 Correct 120 ms 135520 KB Output is correct
17 Correct 119 ms 135516 KB Output is correct
18 Correct 119 ms 135368 KB Output is correct
19 Correct 123 ms 135364 KB Output is correct
20 Correct 125 ms 135244 KB Output is correct
21 Correct 119 ms 135316 KB Output is correct
22 Correct 120 ms 135240 KB Output is correct
23 Correct 119 ms 135376 KB Output is correct
24 Correct 120 ms 135548 KB Output is correct
25 Correct 122 ms 135468 KB Output is correct
26 Correct 120 ms 135456 KB Output is correct
27 Correct 127 ms 135516 KB Output is correct
28 Correct 119 ms 135356 KB Output is correct
29 Correct 126 ms 135364 KB Output is correct
30 Correct 122 ms 135368 KB Output is correct
31 Correct 122 ms 135512 KB Output is correct
32 Correct 120 ms 135476 KB Output is correct
33 Correct 121 ms 135364 KB Output is correct
34 Correct 121 ms 135360 KB Output is correct
35 Correct 118 ms 135420 KB Output is correct
36 Correct 126 ms 135468 KB Output is correct
37 Correct 122 ms 135464 KB Output is correct
38 Correct 121 ms 135508 KB Output is correct
39 Correct 116 ms 135504 KB Output is correct
40 Correct 116 ms 135516 KB Output is correct
41 Correct 116 ms 135512 KB Output is correct
42 Correct 117 ms 135368 KB Output is correct
43 Correct 113 ms 135352 KB Output is correct
44 Correct 116 ms 135264 KB Output is correct
45 Correct 119 ms 135240 KB Output is correct
46 Correct 224 ms 139564 KB Output is correct
47 Correct 264 ms 141888 KB Output is correct
48 Correct 265 ms 142048 KB Output is correct
49 Correct 324 ms 144492 KB Output is correct
50 Correct 360 ms 144456 KB Output is correct
51 Correct 296 ms 144460 KB Output is correct
52 Correct 311 ms 144436 KB Output is correct
53 Correct 158 ms 136892 KB Output is correct
54 Correct 182 ms 136896 KB Output is correct
55 Correct 160 ms 136828 KB Output is correct
56 Correct 166 ms 136908 KB Output is correct
57 Correct 256 ms 142088 KB Output is correct
58 Correct 301 ms 144404 KB Output is correct
59 Correct 310 ms 144452 KB Output is correct
60 Correct 172 ms 136896 KB Output is correct
61 Correct 153 ms 136908 KB Output is correct
62 Correct 257 ms 142076 KB Output is correct
63 Correct 320 ms 144484 KB Output is correct
64 Correct 315 ms 144404 KB Output is correct
65 Correct 164 ms 136900 KB Output is correct
66 Correct 167 ms 136900 KB Output is correct
67 Correct 254 ms 141496 KB Output is correct
68 Correct 266 ms 141984 KB Output is correct
69 Correct 251 ms 141952 KB Output is correct
70 Correct 339 ms 144476 KB Output is correct
71 Correct 327 ms 144532 KB Output is correct
72 Correct 305 ms 144432 KB Output is correct
73 Correct 336 ms 144484 KB Output is correct
74 Correct 159 ms 136900 KB Output is correct
75 Correct 163 ms 136904 KB Output is correct
76 Correct 159 ms 136784 KB Output is correct
77 Correct 158 ms 136904 KB Output is correct
78 Correct 876 ms 141956 KB Output is correct
79 Correct 1123 ms 141992 KB Output is correct
80 Correct 1389 ms 142092 KB Output is correct
81 Correct 1066 ms 144496 KB Output is correct
82 Correct 1290 ms 144504 KB Output is correct
83 Correct 1327 ms 144424 KB Output is correct
84 Correct 1028 ms 144492 KB Output is correct
85 Correct 831 ms 136912 KB Output is correct
86 Correct 887 ms 136908 KB Output is correct
87 Correct 916 ms 136904 KB Output is correct
88 Correct 1125 ms 136900 KB Output is correct
89 Correct 1113 ms 136900 KB Output is correct
90 Correct 1067 ms 136900 KB Output is correct
91 Correct 129 ms 135328 KB Output is correct
92 Correct 119 ms 135336 KB Output is correct
93 Correct 120 ms 135360 KB Output is correct
94 Correct 252 ms 142096 KB Output is correct
95 Correct 335 ms 144516 KB Output is correct
96 Correct 316 ms 144412 KB Output is correct
97 Correct 166 ms 136896 KB Output is correct
98 Correct 161 ms 136896 KB Output is correct
99 Correct 269 ms 142020 KB Output is correct
100 Correct 375 ms 144508 KB Output is correct
101 Correct 314 ms 144476 KB Output is correct
102 Correct 160 ms 136896 KB Output is correct
103 Correct 167 ms 136908 KB Output is correct
104 Correct 122 ms 135372 KB Output is correct
105 Correct 131 ms 135516 KB Output is correct
106 Correct 123 ms 135468 KB Output is correct
107 Correct 123 ms 135304 KB Output is correct
108 Correct 120 ms 135364 KB Output is correct
109 Correct 121 ms 135460 KB Output is correct
110 Correct 122 ms 135516 KB Output is correct
111 Correct 120 ms 135532 KB Output is correct
112 Correct 118 ms 135240 KB Output is correct
113 Correct 125 ms 135368 KB Output is correct
114 Correct 463 ms 136900 KB Output is correct
115 Correct 1464 ms 142028 KB Output is correct
116 Correct 1523 ms 142032 KB Output is correct
117 Correct 1513 ms 144620 KB Output is correct
118 Correct 1604 ms 144596 KB Output is correct
119 Correct 1593 ms 144520 KB Output is correct
120 Correct 1582 ms 144528 KB Output is correct
121 Correct 995 ms 136900 KB Output is correct
122 Correct 1006 ms 136912 KB Output is correct
123 Correct 1002 ms 136900 KB Output is correct
124 Correct 963 ms 136872 KB Output is correct
125 Correct 271 ms 142312 KB Output is correct
126 Correct 309 ms 144484 KB Output is correct
127 Correct 306 ms 144484 KB Output is correct
128 Correct 160 ms 136904 KB Output is correct
129 Correct 159 ms 136828 KB Output is correct
130 Correct 248 ms 141520 KB Output is correct
131 Correct 259 ms 141968 KB Output is correct
132 Correct 289 ms 141952 KB Output is correct
133 Correct 332 ms 144572 KB Output is correct
134 Correct 312 ms 144428 KB Output is correct
135 Correct 328 ms 144436 KB Output is correct
136 Correct 305 ms 144516 KB Output is correct
137 Correct 172 ms 136876 KB Output is correct
138 Correct 162 ms 137008 KB Output is correct
139 Correct 167 ms 136872 KB Output is correct
140 Correct 159 ms 136900 KB Output is correct
141 Correct 121 ms 135464 KB Output is correct
142 Correct 124 ms 135572 KB Output is correct
143 Correct 122 ms 135512 KB Output is correct
144 Correct 121 ms 135288 KB Output is correct
145 Correct 120 ms 135360 KB Output is correct
146 Correct 120 ms 135344 KB Output is correct
147 Correct 121 ms 135476 KB Output is correct
148 Correct 123 ms 135368 KB Output is correct
149 Correct 122 ms 135492 KB Output is correct
150 Correct 122 ms 135496 KB Output is correct
151 Correct 123 ms 135580 KB Output is correct
152 Correct 122 ms 135512 KB Output is correct
153 Correct 129 ms 135360 KB Output is correct
154 Correct 120 ms 135292 KB Output is correct
155 Correct 120 ms 135268 KB Output is correct
156 Correct 122 ms 135368 KB Output is correct
157 Correct 1004 ms 141024 KB Output is correct
158 Correct 1168 ms 142080 KB Output is correct
159 Correct 1082 ms 141940 KB Output is correct
160 Correct 1223 ms 144480 KB Output is correct
161 Correct 1395 ms 144516 KB Output is correct
162 Correct 1300 ms 144472 KB Output is correct
163 Correct 1266 ms 144440 KB Output is correct
164 Correct 1087 ms 136912 KB Output is correct
165 Correct 1104 ms 136900 KB Output is correct
166 Correct 1018 ms 137016 KB Output is correct
167 Correct 988 ms 136904 KB Output is correct
168 Correct 121 ms 135332 KB Output is correct
169 Correct 696 ms 137540 KB Output is correct
170 Correct 1327 ms 142084 KB Output is correct
171 Correct 1299 ms 141984 KB Output is correct
172 Correct 1287 ms 144452 KB Output is correct
173 Correct 1282 ms 144416 KB Output is correct
174 Correct 1256 ms 144516 KB Output is correct
175 Correct 1307 ms 144472 KB Output is correct
176 Correct 1047 ms 136792 KB Output is correct
177 Correct 865 ms 136896 KB Output is correct
178 Correct 1022 ms 136880 KB Output is correct
179 Correct 956 ms 136872 KB Output is correct