Submission #763569

# Submission time Handle Problem Language Result Execution time Memory
763569 2023-06-22T13:05:05 Z amunduzbaev Radio Towers (IOI22_towers) C++17
60 / 100
4000 ms 18992 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;
 
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();
	
	//~ int j = lower_bound(res.begin(), res.end(), (ar<int, 2>){d, 0}) - res.begin();
	//~ return (int)res.size() - j;
	//~ int res = block.get(l, r, D);
	
	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);
	
	auto get01 = [&](int l, int r, int d){
		int mn = inf;
		for(int i=l;i<=r;i++){
			if(a[i] >= mn + d){
				return i;
			}
			mn = min(mn, a[i]);
		}
		
		return -1;
	};
	auto get10 = [&](int l, int r, int d){
		int mn = inf;
		for(int i=r;i>=l;i--){
			if(a[i] >= mn + d){
				return i;
			}
			mn = min(mn, a[i]);
		}
		
		return -1;
	};
	
	if(!res){
		int l_ = tree.get01(l, r, d), r_ = tree.get10(l, r, d);
		if(~l_ && ~r_ && l_ <= r_){
			return 2;
		}
		
		return 1;
	}
	
	auto first = [&](int l, int r, int d){
		for(int i=l;i<=r;i++){
			if(v[i] >= d) return i;
		}
		assert(false);
		return -1;
	};
	
	auto last = [&](int l, int r, int d){
		for(int i=r;i>=l;i--){
			if(v[i] >= d) return i;
		}
		assert(false);
		return -1;
	};
	
	int l_ = DMax.first(l, r, D), r_ = DMax.last(l, r, D);
	assert(~l_ && ~r_);
	//~ int l_ = first(l, r, D), r_ = last(l, r, D);
	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:280:6: warning: unused variable 'n' [-Wunused-variable]
  280 |  int n = a.size();
      |      ^
towers.cpp:296:7: warning: variable 'get01' set but not used [-Wunused-but-set-variable]
  296 |  auto get01 = [&](int l, int r, int d){
      |       ^~~~~
towers.cpp:307:7: warning: variable 'get10' set but not used [-Wunused-but-set-variable]
  307 |  auto get10 = [&](int l, int r, int d){
      |       ^~~~~
towers.cpp:328:7: warning: variable 'first' set but not used [-Wunused-but-set-variable]
  328 |  auto first = [&](int l, int r, int d){
      |       ^~~~~
towers.cpp:336:7: warning: variable 'last' set but not used [-Wunused-but-set-variable]
  336 |  auto last = [&](int l, int r, int d){
      |       ^~~~
# Verdict Execution time Memory Grader output
1 Correct 947 ms 10648 KB Output is correct
2 Correct 2921 ms 11252 KB Output is correct
3 Correct 2895 ms 11260 KB Output is correct
4 Correct 2693 ms 11264 KB Output is correct
5 Correct 2705 ms 11256 KB Output is correct
6 Correct 2900 ms 11240 KB Output is correct
7 Correct 2986 ms 11248 KB Output is correct
8 Correct 4 ms 9680 KB Output is correct
9 Correct 5 ms 9664 KB Output is correct
10 Correct 5 ms 9712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9672 KB Output is correct
2 Correct 6 ms 9808 KB Output is correct
3 Correct 6 ms 9808 KB Output is correct
4 Correct 6 ms 9808 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9712 KB Output is correct
9 Correct 5 ms 9724 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9712 KB Output is correct
12 Correct 4 ms 9680 KB Output is correct
13 Correct 4 ms 9680 KB Output is correct
14 Correct 4 ms 9680 KB Output is correct
15 Correct 6 ms 9808 KB Output is correct
16 Correct 7 ms 9820 KB Output is correct
17 Correct 7 ms 9892 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 4 ms 9680 KB Output is correct
20 Correct 6 ms 9808 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 7 ms 9804 KB Output is correct
23 Correct 4 ms 9680 KB Output is correct
24 Correct 4 ms 9680 KB Output is correct
25 Correct 5 ms 9680 KB Output is correct
26 Correct 6 ms 9848 KB Output is correct
27 Correct 6 ms 9840 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9808 KB Output is correct
30 Correct 6 ms 9892 KB Output is correct
31 Correct 6 ms 9808 KB Output is correct
32 Correct 4 ms 9680 KB Output is correct
33 Correct 6 ms 9680 KB Output is correct
34 Correct 4 ms 9680 KB Output is correct
35 Correct 4 ms 9680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9672 KB Output is correct
2 Correct 6 ms 9808 KB Output is correct
3 Correct 6 ms 9808 KB Output is correct
4 Correct 6 ms 9808 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9712 KB Output is correct
9 Correct 5 ms 9724 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9712 KB Output is correct
12 Correct 4 ms 9680 KB Output is correct
13 Correct 4 ms 9680 KB Output is correct
14 Correct 4 ms 9680 KB Output is correct
15 Correct 6 ms 9808 KB Output is correct
16 Correct 7 ms 9820 KB Output is correct
17 Correct 7 ms 9892 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 4 ms 9680 KB Output is correct
20 Correct 6 ms 9808 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 7 ms 9804 KB Output is correct
23 Correct 4 ms 9680 KB Output is correct
24 Correct 4 ms 9680 KB Output is correct
25 Correct 5 ms 9680 KB Output is correct
26 Correct 6 ms 9848 KB Output is correct
27 Correct 6 ms 9840 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9808 KB Output is correct
30 Correct 6 ms 9892 KB Output is correct
31 Correct 6 ms 9808 KB Output is correct
32 Correct 4 ms 9680 KB Output is correct
33 Correct 6 ms 9680 KB Output is correct
34 Correct 4 ms 9680 KB Output is correct
35 Correct 4 ms 9680 KB Output is correct
36 Correct 82 ms 13880 KB Output is correct
37 Correct 130 ms 16336 KB Output is correct
38 Correct 136 ms 16448 KB Output is correct
39 Correct 197 ms 18872 KB Output is correct
40 Correct 191 ms 18812 KB Output is correct
41 Correct 202 ms 18992 KB Output is correct
42 Correct 231 ms 18824 KB Output is correct
43 Correct 42 ms 11272 KB Output is correct
44 Correct 42 ms 11264 KB Output is correct
45 Correct 42 ms 11216 KB Output is correct
46 Correct 43 ms 11260 KB Output is correct
47 Correct 135 ms 16368 KB Output is correct
48 Correct 196 ms 18860 KB Output is correct
49 Correct 190 ms 18852 KB Output is correct
50 Correct 51 ms 11264 KB Output is correct
51 Correct 42 ms 11260 KB Output is correct
52 Correct 133 ms 16436 KB Output is correct
53 Correct 208 ms 18780 KB Output is correct
54 Correct 203 ms 18804 KB Output is correct
55 Correct 42 ms 11256 KB Output is correct
56 Correct 43 ms 11212 KB Output is correct
57 Correct 131 ms 15848 KB Output is correct
58 Correct 139 ms 16232 KB Output is correct
59 Correct 139 ms 16540 KB Output is correct
60 Correct 206 ms 18784 KB Output is correct
61 Correct 197 ms 18784 KB Output is correct
62 Correct 212 ms 18796 KB Output is correct
63 Correct 200 ms 18824 KB Output is correct
64 Correct 41 ms 11216 KB Output is correct
65 Correct 52 ms 11244 KB Output is correct
66 Correct 42 ms 11272 KB Output is correct
67 Correct 42 ms 11128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2387 ms 16328 KB Output is correct
2 Correct 2816 ms 16368 KB Output is correct
3 Correct 2845 ms 16452 KB Output is correct
4 Correct 3142 ms 18884 KB Output is correct
5 Correct 2935 ms 18860 KB Output is correct
6 Correct 3011 ms 18804 KB Output is correct
7 Correct 2952 ms 18856 KB Output is correct
8 Correct 2785 ms 11284 KB Output is correct
9 Correct 2846 ms 11256 KB Output is correct
10 Correct 3004 ms 11132 KB Output is correct
11 Correct 2885 ms 11216 KB Output is correct
12 Correct 2897 ms 11256 KB Output is correct
13 Correct 2901 ms 11208 KB Output is correct
14 Correct 4 ms 9680 KB Output is correct
15 Correct 5 ms 9680 KB Output is correct
16 Correct 5 ms 9680 KB Output is correct
17 Correct 133 ms 16348 KB Output is correct
18 Correct 237 ms 18848 KB Output is correct
19 Correct 206 ms 18756 KB Output is correct
20 Correct 42 ms 11264 KB Output is correct
21 Correct 43 ms 11216 KB Output is correct
22 Correct 149 ms 16372 KB Output is correct
23 Correct 204 ms 18888 KB Output is correct
24 Correct 198 ms 18848 KB Output is correct
25 Correct 43 ms 11236 KB Output is correct
26 Correct 41 ms 11240 KB Output is correct
27 Correct 6 ms 9808 KB Output is correct
28 Correct 7 ms 9808 KB Output is correct
29 Correct 6 ms 9812 KB Output is correct
30 Correct 5 ms 9704 KB Output is correct
31 Correct 5 ms 9680 KB Output is correct
32 Correct 6 ms 9808 KB Output is correct
33 Correct 6 ms 9836 KB Output is correct
34 Correct 6 ms 9808 KB Output is correct
35 Correct 4 ms 9680 KB Output is correct
36 Correct 5 ms 9680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 753 ms 11252 KB Output is correct
2 Execution timed out 4053 ms 16468 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9672 KB Output is correct
2 Correct 6 ms 9808 KB Output is correct
3 Correct 6 ms 9808 KB Output is correct
4 Correct 6 ms 9808 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9712 KB Output is correct
9 Correct 5 ms 9724 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9712 KB Output is correct
12 Correct 4 ms 9680 KB Output is correct
13 Correct 4 ms 9680 KB Output is correct
14 Correct 4 ms 9680 KB Output is correct
15 Correct 6 ms 9808 KB Output is correct
16 Correct 7 ms 9820 KB Output is correct
17 Correct 7 ms 9892 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 4 ms 9680 KB Output is correct
20 Correct 6 ms 9808 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 7 ms 9804 KB Output is correct
23 Correct 4 ms 9680 KB Output is correct
24 Correct 4 ms 9680 KB Output is correct
25 Correct 5 ms 9680 KB Output is correct
26 Correct 6 ms 9848 KB Output is correct
27 Correct 6 ms 9840 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9808 KB Output is correct
30 Correct 6 ms 9892 KB Output is correct
31 Correct 6 ms 9808 KB Output is correct
32 Correct 4 ms 9680 KB Output is correct
33 Correct 6 ms 9680 KB Output is correct
34 Correct 4 ms 9680 KB Output is correct
35 Correct 4 ms 9680 KB Output is correct
36 Correct 82 ms 13880 KB Output is correct
37 Correct 130 ms 16336 KB Output is correct
38 Correct 136 ms 16448 KB Output is correct
39 Correct 197 ms 18872 KB Output is correct
40 Correct 191 ms 18812 KB Output is correct
41 Correct 202 ms 18992 KB Output is correct
42 Correct 231 ms 18824 KB Output is correct
43 Correct 42 ms 11272 KB Output is correct
44 Correct 42 ms 11264 KB Output is correct
45 Correct 42 ms 11216 KB Output is correct
46 Correct 43 ms 11260 KB Output is correct
47 Correct 135 ms 16368 KB Output is correct
48 Correct 196 ms 18860 KB Output is correct
49 Correct 190 ms 18852 KB Output is correct
50 Correct 51 ms 11264 KB Output is correct
51 Correct 42 ms 11260 KB Output is correct
52 Correct 133 ms 16436 KB Output is correct
53 Correct 208 ms 18780 KB Output is correct
54 Correct 203 ms 18804 KB Output is correct
55 Correct 42 ms 11256 KB Output is correct
56 Correct 43 ms 11212 KB Output is correct
57 Correct 131 ms 15848 KB Output is correct
58 Correct 139 ms 16232 KB Output is correct
59 Correct 139 ms 16540 KB Output is correct
60 Correct 206 ms 18784 KB Output is correct
61 Correct 197 ms 18784 KB Output is correct
62 Correct 212 ms 18796 KB Output is correct
63 Correct 200 ms 18824 KB Output is correct
64 Correct 41 ms 11216 KB Output is correct
65 Correct 52 ms 11244 KB Output is correct
66 Correct 42 ms 11272 KB Output is correct
67 Correct 42 ms 11128 KB Output is correct
68 Correct 2387 ms 16328 KB Output is correct
69 Correct 2816 ms 16368 KB Output is correct
70 Correct 2845 ms 16452 KB Output is correct
71 Correct 3142 ms 18884 KB Output is correct
72 Correct 2935 ms 18860 KB Output is correct
73 Correct 3011 ms 18804 KB Output is correct
74 Correct 2952 ms 18856 KB Output is correct
75 Correct 2785 ms 11284 KB Output is correct
76 Correct 2846 ms 11256 KB Output is correct
77 Correct 3004 ms 11132 KB Output is correct
78 Correct 2885 ms 11216 KB Output is correct
79 Correct 2897 ms 11256 KB Output is correct
80 Correct 2901 ms 11208 KB Output is correct
81 Correct 4 ms 9680 KB Output is correct
82 Correct 5 ms 9680 KB Output is correct
83 Correct 5 ms 9680 KB Output is correct
84 Correct 133 ms 16348 KB Output is correct
85 Correct 237 ms 18848 KB Output is correct
86 Correct 206 ms 18756 KB Output is correct
87 Correct 42 ms 11264 KB Output is correct
88 Correct 43 ms 11216 KB Output is correct
89 Correct 149 ms 16372 KB Output is correct
90 Correct 204 ms 18888 KB Output is correct
91 Correct 198 ms 18848 KB Output is correct
92 Correct 43 ms 11236 KB Output is correct
93 Correct 41 ms 11240 KB Output is correct
94 Correct 6 ms 9808 KB Output is correct
95 Correct 7 ms 9808 KB Output is correct
96 Correct 6 ms 9812 KB Output is correct
97 Correct 5 ms 9704 KB Output is correct
98 Correct 5 ms 9680 KB Output is correct
99 Correct 6 ms 9808 KB Output is correct
100 Correct 6 ms 9836 KB Output is correct
101 Correct 6 ms 9808 KB Output is correct
102 Correct 4 ms 9680 KB Output is correct
103 Correct 5 ms 9680 KB Output is correct
104 Correct 2452 ms 15412 KB Output is correct
105 Correct 2955 ms 16364 KB Output is correct
106 Correct 3155 ms 16324 KB Output is correct
107 Correct 2953 ms 18884 KB Output is correct
108 Correct 3184 ms 18884 KB Output is correct
109 Correct 3150 ms 18904 KB Output is correct
110 Correct 3095 ms 18796 KB Output is correct
111 Correct 2716 ms 11216 KB Output is correct
112 Correct 2696 ms 11208 KB Output is correct
113 Correct 2941 ms 11248 KB Output is correct
114 Correct 2955 ms 11256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 947 ms 10648 KB Output is correct
2 Correct 2921 ms 11252 KB Output is correct
3 Correct 2895 ms 11260 KB Output is correct
4 Correct 2693 ms 11264 KB Output is correct
5 Correct 2705 ms 11256 KB Output is correct
6 Correct 2900 ms 11240 KB Output is correct
7 Correct 2986 ms 11248 KB Output is correct
8 Correct 4 ms 9680 KB Output is correct
9 Correct 5 ms 9664 KB Output is correct
10 Correct 5 ms 9712 KB Output is correct
11 Correct 11 ms 9672 KB Output is correct
12 Correct 6 ms 9808 KB Output is correct
13 Correct 6 ms 9808 KB Output is correct
14 Correct 6 ms 9808 KB Output is correct
15 Correct 6 ms 9808 KB Output is correct
16 Correct 6 ms 9808 KB Output is correct
17 Correct 6 ms 9808 KB Output is correct
18 Correct 5 ms 9712 KB Output is correct
19 Correct 5 ms 9724 KB Output is correct
20 Correct 5 ms 9680 KB Output is correct
21 Correct 5 ms 9712 KB Output is correct
22 Correct 4 ms 9680 KB Output is correct
23 Correct 4 ms 9680 KB Output is correct
24 Correct 4 ms 9680 KB Output is correct
25 Correct 6 ms 9808 KB Output is correct
26 Correct 7 ms 9820 KB Output is correct
27 Correct 7 ms 9892 KB Output is correct
28 Correct 5 ms 9680 KB Output is correct
29 Correct 4 ms 9680 KB Output is correct
30 Correct 6 ms 9808 KB Output is correct
31 Correct 6 ms 9808 KB Output is correct
32 Correct 7 ms 9804 KB Output is correct
33 Correct 4 ms 9680 KB Output is correct
34 Correct 4 ms 9680 KB Output is correct
35 Correct 5 ms 9680 KB Output is correct
36 Correct 6 ms 9848 KB Output is correct
37 Correct 6 ms 9840 KB Output is correct
38 Correct 6 ms 9808 KB Output is correct
39 Correct 6 ms 9808 KB Output is correct
40 Correct 6 ms 9892 KB Output is correct
41 Correct 6 ms 9808 KB Output is correct
42 Correct 4 ms 9680 KB Output is correct
43 Correct 6 ms 9680 KB Output is correct
44 Correct 4 ms 9680 KB Output is correct
45 Correct 4 ms 9680 KB Output is correct
46 Correct 82 ms 13880 KB Output is correct
47 Correct 130 ms 16336 KB Output is correct
48 Correct 136 ms 16448 KB Output is correct
49 Correct 197 ms 18872 KB Output is correct
50 Correct 191 ms 18812 KB Output is correct
51 Correct 202 ms 18992 KB Output is correct
52 Correct 231 ms 18824 KB Output is correct
53 Correct 42 ms 11272 KB Output is correct
54 Correct 42 ms 11264 KB Output is correct
55 Correct 42 ms 11216 KB Output is correct
56 Correct 43 ms 11260 KB Output is correct
57 Correct 135 ms 16368 KB Output is correct
58 Correct 196 ms 18860 KB Output is correct
59 Correct 190 ms 18852 KB Output is correct
60 Correct 51 ms 11264 KB Output is correct
61 Correct 42 ms 11260 KB Output is correct
62 Correct 133 ms 16436 KB Output is correct
63 Correct 208 ms 18780 KB Output is correct
64 Correct 203 ms 18804 KB Output is correct
65 Correct 42 ms 11256 KB Output is correct
66 Correct 43 ms 11212 KB Output is correct
67 Correct 131 ms 15848 KB Output is correct
68 Correct 139 ms 16232 KB Output is correct
69 Correct 139 ms 16540 KB Output is correct
70 Correct 206 ms 18784 KB Output is correct
71 Correct 197 ms 18784 KB Output is correct
72 Correct 212 ms 18796 KB Output is correct
73 Correct 200 ms 18824 KB Output is correct
74 Correct 41 ms 11216 KB Output is correct
75 Correct 52 ms 11244 KB Output is correct
76 Correct 42 ms 11272 KB Output is correct
77 Correct 42 ms 11128 KB Output is correct
78 Correct 2387 ms 16328 KB Output is correct
79 Correct 2816 ms 16368 KB Output is correct
80 Correct 2845 ms 16452 KB Output is correct
81 Correct 3142 ms 18884 KB Output is correct
82 Correct 2935 ms 18860 KB Output is correct
83 Correct 3011 ms 18804 KB Output is correct
84 Correct 2952 ms 18856 KB Output is correct
85 Correct 2785 ms 11284 KB Output is correct
86 Correct 2846 ms 11256 KB Output is correct
87 Correct 3004 ms 11132 KB Output is correct
88 Correct 2885 ms 11216 KB Output is correct
89 Correct 2897 ms 11256 KB Output is correct
90 Correct 2901 ms 11208 KB Output is correct
91 Correct 4 ms 9680 KB Output is correct
92 Correct 5 ms 9680 KB Output is correct
93 Correct 5 ms 9680 KB Output is correct
94 Correct 133 ms 16348 KB Output is correct
95 Correct 237 ms 18848 KB Output is correct
96 Correct 206 ms 18756 KB Output is correct
97 Correct 42 ms 11264 KB Output is correct
98 Correct 43 ms 11216 KB Output is correct
99 Correct 149 ms 16372 KB Output is correct
100 Correct 204 ms 18888 KB Output is correct
101 Correct 198 ms 18848 KB Output is correct
102 Correct 43 ms 11236 KB Output is correct
103 Correct 41 ms 11240 KB Output is correct
104 Correct 6 ms 9808 KB Output is correct
105 Correct 7 ms 9808 KB Output is correct
106 Correct 6 ms 9812 KB Output is correct
107 Correct 5 ms 9704 KB Output is correct
108 Correct 5 ms 9680 KB Output is correct
109 Correct 6 ms 9808 KB Output is correct
110 Correct 6 ms 9836 KB Output is correct
111 Correct 6 ms 9808 KB Output is correct
112 Correct 4 ms 9680 KB Output is correct
113 Correct 5 ms 9680 KB Output is correct
114 Correct 753 ms 11252 KB Output is correct
115 Execution timed out 4053 ms 16468 KB Time limit exceeded
116 Halted 0 ms 0 KB -