#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,sse4,bmi,abm")
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int mod = 1e9 + 7, oo = 1e9 + 7;
/*
Algo (Ig)
*/
int n, k, q;
int a[N], b[N], x[N], t[N];
int l[N], y[N];
vector<int> times;
vector<ii> opes[1048576];
vector<int> asks[N];
multiset<int> mls[N];
int mini[1048576], maxi[1048576];
vector<int> ask_pos;
// get position to add/erase
ii get_pos(int l, int r){
assert(l <= r);
int temp1 = lower_bound(ask_pos.begin(), ask_pos.end(), l) - ask_pos.begin();
int temp2 = upper_bound(ask_pos.begin(), ask_pos.end(), r) - ask_pos.begin();
temp2--;
if(temp2 < temp1){
// cout << "OK\n";
// exit(0);
}
//assert(temp2 >= temp1);
return {temp1, temp2};
}
void build(int id, int l, int r){
mini[id] = oo;
maxi[id] = -oo;
if(l == r) return;
int mid = (l + r) >> 1;
build(id << 1, l, mid);
build(id << 1 | 1, mid + 1, r);
}
iii ope[10000005];
int tol = 0, itr = 0;
// update the minimum & maximum
void add(int id, int l, int r, int L, int R, int val, int type){
if(l > R || r < L) return;
if(!type){
if(mini[id] <= val) return;
}
else{
if(maxi[id] >= val) return;
}
if(l >= L && r <= R){
if(!type){
// if(mini[id] <= val) return;
tol++;
itr++;
ope[itr] = {{id, 0}, mini[id]};
mini[id] = val;
}
else{
// if(maxi[id] >= val) return;
tol++;
itr++;
ope[itr] = {{id, 1}, maxi[id]};
maxi[id] = val;
}
//tol++;
return;
}
int mid = (l + r) >> 1;
add(id << 1, l, mid, L, R, val, type);
add(id << 1 | 1, mid + 1, r, L, R, val, type);
}
// erase the lasest changes
/*
void er(int id, int l, int r, int L, int R, int type){
if(l > R || r < L || l > r) return;
if(l >= L && r <= R){
if(!type){
// assert(mini[id].size());
mini[id].pop_back();
}
else{
// assert(maxi[id].size());
maxi[id].pop_back();
}
return;
}
int mid = (l + r) >> 1;
er(id << 1, l, mid, L, R, type);
er(id << 1 | 1, mid + 1, r, L, R, type);
}*/
int answer[N];
ii ans_que = {oo, -oo};
// easy query stuff
void que(int id, int l, int r, int pos){
ans_que.fi = min(ans_que.fi, mini[id]);
ans_que.se = max(ans_que.se, maxi[id]);
if(l == r) return;
int mid = (l + r) >> 1;
if(pos <= mid) que(id << 1, l, mid, pos);
else que(id << 1 | 1, mid + 1, r, pos);
}
// for persistent segment tree
void upd(int id, int l, int r, int L, int R, ii v){
if(l > R || r < L) return;
if(l >= L && r <= R){
opes[id].pb(v);
return;
}
int mid = (l + r) >> 1;
upd(id << 1, l, mid, L, R, v);
upd(id << 1 | 1, mid + 1, r, L, R, v);
}
map<ii, int> answ;// b/c i'm lazy
void trav(int id, int l, int r){
//cout << id << " " << l << " " << r << "\n";
tol = 0;
for(auto it : opes[id]){
// cout << id << " " << l << " " << r << " " << it.fi << " " << it.se << "\n";
if(mls[it.se].size() == 1){
add(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, -oo, 0);
add(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, oo, 1);
mls[it.se].clear();
continue;
}
multiset<int>::iterator itt = mls[it.se].lower_bound(it.fi), itt2 = itt, itt3;
// mls[it.se].erase(itt);
// continue;
// if(itt == mls[it.se].end()) exit(0);
// assert(itt != mls[it.se].end());
itt2++;
bool ck1 = (itt == mls[it.se].begin()), ck2 = (itt2 == mls[it.se].end());
if(ck1){// the left side is missing
int pos = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
pos--;
if(pos) add(1, 1, ask_pos.size() - 1, 1, pos, (*itt2), 1);
}
else if(ck2){// the right side is missing
itt2--;
itt2--;
int pos = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
if(pos < ask_pos.size()) add(1, 1, ask_pos.size() - 1, pos, ask_pos.size() - 1, (*itt2), 0);
}
else{
itt2 = itt3 = itt;
itt2++; itt3--;
int md = ((*itt2) + (*itt3)) / 2;
int pos1 = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt3)) - ask_pos.begin();
int pos2 = upper_bound(ask_pos.begin(), ask_pos.end(), md) - ask_pos.begin();
int pos3 = upper_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
pos2--;
pos3--;
if(pos1 <= pos2) add(1, 1, ask_pos.size() - 1, pos1, pos2, (*itt3), 0);
if(pos2 < pos3) add(1, 1, ask_pos.size() - 1, pos2 + 1, pos3, (*itt2), 1);
}
mls[it.se].erase(itt);
}
int temp = tol;
if(l == r){
for(auto it : asks[l]){
ans_que = {oo, -oo};
int temp = lower_bound(ask_pos.begin(), ask_pos.end(), it) - ask_pos.begin();
que(1, 1, ask_pos.size() - 1, temp);
answ[{times[l], it}] = max(it - ans_que.fi, ans_que.se - it);
}
}
else{
int mid = (l + r) >> 1;
trav(id << 1, l, mid);
trav(id << 1 | 1, mid + 1, r);
}
assert(itr >= temp);
for(auto it : opes[id]) mls[it.se].insert(it.fi);
for(int i = 1; i <= temp; i++){
if(!ope[itr].fi.se) mini[ope[itr].fi.fi] = ope[itr].se;
else maxi[ope[itr].fi.fi] = ope[itr].se;
itr--;
assert(itr >= 0);
}
/*
reverse(opes[id].begin(), opes[id].end());
for(auto it : opes[id]){
mls[it.se].insert(it.fi);
multiset<int>::iterator itt = mls[it.se].lower_bound(it.fi), itt2 = itt, itt3;
assert(itt != mls[it.se].end());
itt2++;
bool ck1 = (itt == mls[it.se].begin()), ck2 = (itt2 == mls[it.se].end());
if(ck1 && ck2){
er(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, 0);
er(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, 1);
continue;
}
else if(ck1){
int pos = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
pos--;
if(pos) er(1, 1, ask_pos.size() - 1, 1, pos, 1);
}
else if(ck2){
itt2--;
itt2--;
int pos = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
if(pos < ask_pos.size()) er(1, 1, ask_pos.size() - 1, pos, ask_pos.size() - 1, 0);
}
else{
itt2 = itt3 = itt;
itt2++; itt3--;
int md = ((*itt2) + (*itt3)) / 2;
int pos1 = lower_bound(ask_pos.begin(), ask_pos.end(), (*itt3)) - ask_pos.begin();
int pos2 = upper_bound(ask_pos.begin(), ask_pos.end(), md) - ask_pos.begin();
int pos3 = upper_bound(ask_pos.begin(), ask_pos.end(), (*itt2)) - ask_pos.begin();
pos2--;
pos3--;
if(pos1 <= pos2) er(1, 1, ask_pos.size() - 1, pos1, pos2, 0);
if(pos2 < pos3) er(1, 1, ask_pos.size() - 1, pos2 + 1, pos3, 1);
}
//mls[it.se].insert(it.fi);
}*/
}
void solve_small(){
for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i];
vector<pair<int, ii>> events;
for(int i = 1; i <= q; i++){
cin >> l[i] >> y[i];
ask_pos.pb(l[i]);
}
for(int i = 1; i <= n; i++){
events.pb({a[i], {x[i], t[i]}});
events.pb({b[i] + 1, {-x[i], t[i]}});
}
for(int i = 1; i <= q; i++){
events.pb({y[i], {l[i] + 1e9, 0}});
}
sort(events.begin(), events.end());
for(auto it : events){
if(it.se.se != 0){// update
if(it.se.fi > 0) mls[it.se.se].insert(it.se.fi);
else mls[it.se.se].erase(mls[it.se.se].lower_bound(-it.se.fi));
}
else{
int ans = -oo;
int temp = it.se.fi - 1e9;
for(int i = 1; i <= k; i++){
if(!mls[i].size()){
ans = oo;
break;
}
multiset<int>::iterator it2 = mls[i].lower_bound(temp);
int mini = oo;
if(it2 != mls[i].end()) mini = min(mini, (*it2) - temp);
if(it2 != mls[i].begin()){
it2--;
mini = min(mini, temp - (*it2));
}
ans = max(ans, mini);
}
answ[{it.fi, temp}] = ans;
}
}
for(int i = 1; i <= q; i++) cout << (answ[{y[i], l[i]}] <= 1e8 ? answ[{y[i], l[i]}] : -1) << "\n";
exit(0);
}
void process(){
cin >> n >> k >> q;
if(k <= 20){
solve_small();
return;
}
for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i];
for(int i = 1; i <= q; i++){
cin >> l[i] >> y[i];
ask_pos.pb(l[i]);
}
times.pb(0);
times.pb(1);
times.pb(1e8);
/*
for(int i = 1; i <= n; i++){
if(a[i] > 2) times.pb(a[i] - 1);
if((b[i] + 1) < 1e8) times.pb(b[i] + 1);
}*/
ask_pos.pb(0);
sort(ask_pos.begin(), ask_pos.end());
ask_pos.resize(unique(ask_pos.begin(), ask_pos.end()) - ask_pos.begin());
// push the erase operations
for(int i = 1; i <= q; i++) times.pb(y[i]);
sort(times.begin(), times.end());
times.resize(unique(times.begin(), times.end()) - times.begin());
for(int i = 1; i <= n; i++){
if(a[i] > 1){
int le = 1, ri = lower_bound(times.begin(), times.end(), a[i]) - times.begin();
ri--;
if(le <= ri) upd(1, 1, times.size() - 1, le, ri, {x[i], t[i]});
}
if((b[i] + 1 < 1e8)){
int le = lower_bound(times.begin(), times.end(), b[i] + 1) - times.begin(), ri = times.size() - 1;
upd(1, 1, times.size() - 1, le, ri, {x[i], t[i]});
}
}
//exit(0);
// insert the queries
for(int i = 1; i <= q; i++){
int temp = lower_bound(times.begin(), times.end(), y[i]) - times.begin();
asks[temp].pb(l[i]);
}
// initialize (not erase anything)
for(int i = 1; i <= n; i++) mls[t[i]].insert(x[i]);
// cout << ask_pos.size() - 1 << "\n";
// exit(0);
build(1, 1, ask_pos.size() - 1);
for(int i = 1; i <= k; i++){
if(!mls[i].size()){
add(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, -oo, 0);
add(1, 1, ask_pos.size() - 1, 1, ask_pos.size() - 1, oo, 1);
continue;
}
//continue;
int lst = -oo;
int cnt = 0;
for(multiset<int>::iterator it = mls[i].begin(); it != mls[i].end(); it++){
int le = 1, ri = 1e8;
if(it != mls[i].begin()){
multiset<int>::iterator it2 = it;
it2--;
le = ((*it) + (*it2)) / 2 + 1;
}
multiset<int>::iterator it2 = it;
it2++;
if(it2 != mls[i].end()) ri = ((*it) + (*it2)) / 2;
// if(le > ri || le == ask_pos.size()) continue;
if(le > ri) continue;
if(le > ask_pos.back()) continue;
ii temp = get_pos(le, ri);
if(temp.fi > temp.se) continue;
temp.se = min(temp.se, (int)ask_pos.size() - 1);
if(temp.fi > temp.se) continue;
int posi = lower_bound(ask_pos.begin(), ask_pos.end(), (*it)) - ask_pos.begin();
if(temp.fi < posi) add(1, 1, ask_pos.size() - 1, temp.fi, posi - 1, (*it), 1);
if(posi <= temp.se) add(1, 1, ask_pos.size() - 1, posi, temp.se, (*it), 0);
}
}
//cout << (double)clock() / (double)CLOCKS_PER_SEC << "\n";
//exit(0);
trav(1, 1, times.size() - 1);
//cout << (double)clock() / (double)CLOCKS_PER_SEC << "\n";
for(int i = 1; i <= q; i++) cout << (answ[{y[i], l[i]}] <= 1e8 ? answ[{y[i], l[i]}] : -1) << "\n";
//cout << (double)clock() / (double)CLOCKS_PER_SEC << "\n";
}
signed main(){
ios_base::sync_with_stdio(0);
//freopen("test_input.txt", "r", stdin);
//freopen("test_output.txt", "w", stdout);
cin.tie(0);
process();
}
Compilation message
new_home.cpp: In function 'void trav(int, int, int)':
new_home.cpp:176:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
176 | if(pos < ask_pos.size()) add(1, 1, ask_pos.size() - 1, pos, ask_pos.size() - 1, (*itt2), 0);
| ~~~~^~~~~~~~~~~~~~~~
new_home.cpp: In function 'void process()':
new_home.cpp:353:13: warning: unused variable 'lst' [-Wunused-variable]
353 | int lst = -oo;
| ^~~
new_home.cpp:354:13: warning: unused variable 'cnt' [-Wunused-variable]
354 | int cnt = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
46076 KB |
Output is correct |
2 |
Correct |
24 ms |
46084 KB |
Output is correct |
3 |
Correct |
27 ms |
46016 KB |
Output is correct |
4 |
Correct |
30 ms |
46028 KB |
Output is correct |
5 |
Correct |
27 ms |
46168 KB |
Output is correct |
6 |
Correct |
26 ms |
46160 KB |
Output is correct |
7 |
Correct |
25 ms |
46264 KB |
Output is correct |
8 |
Correct |
27 ms |
46220 KB |
Output is correct |
9 |
Correct |
25 ms |
46248 KB |
Output is correct |
10 |
Correct |
25 ms |
46164 KB |
Output is correct |
11 |
Correct |
24 ms |
46120 KB |
Output is correct |
12 |
Correct |
26 ms |
46168 KB |
Output is correct |
13 |
Correct |
31 ms |
46164 KB |
Output is correct |
14 |
Correct |
28 ms |
46168 KB |
Output is correct |
15 |
Correct |
28 ms |
46208 KB |
Output is correct |
16 |
Correct |
26 ms |
46292 KB |
Output is correct |
17 |
Correct |
27 ms |
46264 KB |
Output is correct |
18 |
Correct |
25 ms |
46204 KB |
Output is correct |
19 |
Correct |
29 ms |
46308 KB |
Output is correct |
20 |
Correct |
26 ms |
46288 KB |
Output is correct |
21 |
Correct |
26 ms |
46080 KB |
Output is correct |
22 |
Correct |
27 ms |
46196 KB |
Output is correct |
23 |
Correct |
27 ms |
46244 KB |
Output is correct |
24 |
Correct |
25 ms |
46292 KB |
Output is correct |
25 |
Correct |
28 ms |
46216 KB |
Output is correct |
26 |
Correct |
26 ms |
46120 KB |
Output is correct |
27 |
Correct |
29 ms |
46164 KB |
Output is correct |
28 |
Correct |
26 ms |
46116 KB |
Output is correct |
29 |
Correct |
25 ms |
46156 KB |
Output is correct |
30 |
Correct |
28 ms |
46180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
46076 KB |
Output is correct |
2 |
Correct |
24 ms |
46084 KB |
Output is correct |
3 |
Correct |
27 ms |
46016 KB |
Output is correct |
4 |
Correct |
30 ms |
46028 KB |
Output is correct |
5 |
Correct |
27 ms |
46168 KB |
Output is correct |
6 |
Correct |
26 ms |
46160 KB |
Output is correct |
7 |
Correct |
25 ms |
46264 KB |
Output is correct |
8 |
Correct |
27 ms |
46220 KB |
Output is correct |
9 |
Correct |
25 ms |
46248 KB |
Output is correct |
10 |
Correct |
25 ms |
46164 KB |
Output is correct |
11 |
Correct |
24 ms |
46120 KB |
Output is correct |
12 |
Correct |
26 ms |
46168 KB |
Output is correct |
13 |
Correct |
31 ms |
46164 KB |
Output is correct |
14 |
Correct |
28 ms |
46168 KB |
Output is correct |
15 |
Correct |
28 ms |
46208 KB |
Output is correct |
16 |
Correct |
26 ms |
46292 KB |
Output is correct |
17 |
Correct |
27 ms |
46264 KB |
Output is correct |
18 |
Correct |
25 ms |
46204 KB |
Output is correct |
19 |
Correct |
29 ms |
46308 KB |
Output is correct |
20 |
Correct |
26 ms |
46288 KB |
Output is correct |
21 |
Correct |
26 ms |
46080 KB |
Output is correct |
22 |
Correct |
27 ms |
46196 KB |
Output is correct |
23 |
Correct |
27 ms |
46244 KB |
Output is correct |
24 |
Correct |
25 ms |
46292 KB |
Output is correct |
25 |
Correct |
28 ms |
46216 KB |
Output is correct |
26 |
Correct |
26 ms |
46120 KB |
Output is correct |
27 |
Correct |
29 ms |
46164 KB |
Output is correct |
28 |
Correct |
26 ms |
46116 KB |
Output is correct |
29 |
Correct |
25 ms |
46156 KB |
Output is correct |
30 |
Correct |
28 ms |
46180 KB |
Output is correct |
31 |
Correct |
934 ms |
70928 KB |
Output is correct |
32 |
Correct |
95 ms |
52088 KB |
Output is correct |
33 |
Correct |
219 ms |
57588 KB |
Output is correct |
34 |
Correct |
898 ms |
71540 KB |
Output is correct |
35 |
Correct |
975 ms |
71268 KB |
Output is correct |
36 |
Correct |
272 ms |
58188 KB |
Output is correct |
37 |
Correct |
214 ms |
57168 KB |
Output is correct |
38 |
Correct |
140 ms |
57084 KB |
Output is correct |
39 |
Correct |
123 ms |
56892 KB |
Output is correct |
40 |
Correct |
131 ms |
56828 KB |
Output is correct |
41 |
Correct |
617 ms |
71580 KB |
Output is correct |
42 |
Correct |
608 ms |
71284 KB |
Output is correct |
43 |
Correct |
67 ms |
53856 KB |
Output is correct |
44 |
Correct |
700 ms |
72036 KB |
Output is correct |
45 |
Correct |
736 ms |
72460 KB |
Output is correct |
46 |
Correct |
136 ms |
57004 KB |
Output is correct |
47 |
Correct |
102 ms |
56640 KB |
Output is correct |
48 |
Correct |
104 ms |
56576 KB |
Output is correct |
49 |
Correct |
125 ms |
56832 KB |
Output is correct |
50 |
Correct |
510 ms |
72216 KB |
Output is correct |
51 |
Correct |
111 ms |
56684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1104 ms |
108684 KB |
Output is correct |
2 |
Correct |
1730 ms |
99328 KB |
Output is correct |
3 |
Correct |
1057 ms |
108824 KB |
Output is correct |
4 |
Correct |
1120 ms |
108600 KB |
Output is correct |
5 |
Correct |
996 ms |
98812 KB |
Output is correct |
6 |
Correct |
1400 ms |
99340 KB |
Output is correct |
7 |
Correct |
1010 ms |
108608 KB |
Output is correct |
8 |
Correct |
1058 ms |
108664 KB |
Output is correct |
9 |
Correct |
1057 ms |
108608 KB |
Output is correct |
10 |
Correct |
1083 ms |
109132 KB |
Output is correct |
11 |
Correct |
1150 ms |
98976 KB |
Output is correct |
12 |
Correct |
745 ms |
109548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4240 ms |
144056 KB |
Output is correct |
2 |
Correct |
442 ms |
79552 KB |
Output is correct |
3 |
Correct |
1884 ms |
89028 KB |
Output is correct |
4 |
Correct |
1825 ms |
143416 KB |
Output is correct |
5 |
Correct |
2806 ms |
143372 KB |
Output is correct |
6 |
Correct |
2689 ms |
143452 KB |
Output is correct |
7 |
Correct |
920 ms |
88524 KB |
Output is correct |
8 |
Correct |
1270 ms |
88768 KB |
Output is correct |
9 |
Correct |
1622 ms |
135040 KB |
Output is correct |
10 |
Correct |
2346 ms |
138848 KB |
Output is correct |
11 |
Correct |
3187 ms |
142356 KB |
Output is correct |
12 |
Correct |
4029 ms |
145852 KB |
Output is correct |
13 |
Correct |
628 ms |
86256 KB |
Output is correct |
14 |
Correct |
557 ms |
85912 KB |
Output is correct |
15 |
Correct |
1022 ms |
87904 KB |
Output is correct |
16 |
Correct |
2539 ms |
143412 KB |
Output is correct |
17 |
Correct |
856 ms |
88304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
46076 KB |
Output is correct |
2 |
Correct |
24 ms |
46084 KB |
Output is correct |
3 |
Correct |
27 ms |
46016 KB |
Output is correct |
4 |
Correct |
30 ms |
46028 KB |
Output is correct |
5 |
Correct |
27 ms |
46168 KB |
Output is correct |
6 |
Correct |
26 ms |
46160 KB |
Output is correct |
7 |
Correct |
25 ms |
46264 KB |
Output is correct |
8 |
Correct |
27 ms |
46220 KB |
Output is correct |
9 |
Correct |
25 ms |
46248 KB |
Output is correct |
10 |
Correct |
25 ms |
46164 KB |
Output is correct |
11 |
Correct |
24 ms |
46120 KB |
Output is correct |
12 |
Correct |
26 ms |
46168 KB |
Output is correct |
13 |
Correct |
31 ms |
46164 KB |
Output is correct |
14 |
Correct |
28 ms |
46168 KB |
Output is correct |
15 |
Correct |
28 ms |
46208 KB |
Output is correct |
16 |
Correct |
26 ms |
46292 KB |
Output is correct |
17 |
Correct |
27 ms |
46264 KB |
Output is correct |
18 |
Correct |
25 ms |
46204 KB |
Output is correct |
19 |
Correct |
29 ms |
46308 KB |
Output is correct |
20 |
Correct |
26 ms |
46288 KB |
Output is correct |
21 |
Correct |
26 ms |
46080 KB |
Output is correct |
22 |
Correct |
27 ms |
46196 KB |
Output is correct |
23 |
Correct |
27 ms |
46244 KB |
Output is correct |
24 |
Correct |
25 ms |
46292 KB |
Output is correct |
25 |
Correct |
28 ms |
46216 KB |
Output is correct |
26 |
Correct |
26 ms |
46120 KB |
Output is correct |
27 |
Correct |
29 ms |
46164 KB |
Output is correct |
28 |
Correct |
26 ms |
46116 KB |
Output is correct |
29 |
Correct |
25 ms |
46156 KB |
Output is correct |
30 |
Correct |
28 ms |
46180 KB |
Output is correct |
31 |
Correct |
934 ms |
70928 KB |
Output is correct |
32 |
Correct |
95 ms |
52088 KB |
Output is correct |
33 |
Correct |
219 ms |
57588 KB |
Output is correct |
34 |
Correct |
898 ms |
71540 KB |
Output is correct |
35 |
Correct |
975 ms |
71268 KB |
Output is correct |
36 |
Correct |
272 ms |
58188 KB |
Output is correct |
37 |
Correct |
214 ms |
57168 KB |
Output is correct |
38 |
Correct |
140 ms |
57084 KB |
Output is correct |
39 |
Correct |
123 ms |
56892 KB |
Output is correct |
40 |
Correct |
131 ms |
56828 KB |
Output is correct |
41 |
Correct |
617 ms |
71580 KB |
Output is correct |
42 |
Correct |
608 ms |
71284 KB |
Output is correct |
43 |
Correct |
67 ms |
53856 KB |
Output is correct |
44 |
Correct |
700 ms |
72036 KB |
Output is correct |
45 |
Correct |
736 ms |
72460 KB |
Output is correct |
46 |
Correct |
136 ms |
57004 KB |
Output is correct |
47 |
Correct |
102 ms |
56640 KB |
Output is correct |
48 |
Correct |
104 ms |
56576 KB |
Output is correct |
49 |
Correct |
125 ms |
56832 KB |
Output is correct |
50 |
Correct |
510 ms |
72216 KB |
Output is correct |
51 |
Correct |
111 ms |
56684 KB |
Output is correct |
52 |
Correct |
308 ms |
68300 KB |
Output is correct |
53 |
Correct |
307 ms |
68812 KB |
Output is correct |
54 |
Correct |
485 ms |
67912 KB |
Output is correct |
55 |
Correct |
524 ms |
68856 KB |
Output is correct |
56 |
Correct |
436 ms |
67168 KB |
Output is correct |
57 |
Correct |
624 ms |
69144 KB |
Output is correct |
58 |
Correct |
486 ms |
69864 KB |
Output is correct |
59 |
Correct |
463 ms |
68732 KB |
Output is correct |
60 |
Correct |
569 ms |
69468 KB |
Output is correct |
61 |
Correct |
68 ms |
52552 KB |
Output is correct |
62 |
Correct |
313 ms |
67980 KB |
Output is correct |
63 |
Correct |
417 ms |
68708 KB |
Output is correct |
64 |
Correct |
438 ms |
69036 KB |
Output is correct |
65 |
Correct |
534 ms |
70312 KB |
Output is correct |
66 |
Correct |
640 ms |
69860 KB |
Output is correct |
67 |
Correct |
166 ms |
55124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
46076 KB |
Output is correct |
2 |
Correct |
24 ms |
46084 KB |
Output is correct |
3 |
Correct |
27 ms |
46016 KB |
Output is correct |
4 |
Correct |
30 ms |
46028 KB |
Output is correct |
5 |
Correct |
27 ms |
46168 KB |
Output is correct |
6 |
Correct |
26 ms |
46160 KB |
Output is correct |
7 |
Correct |
25 ms |
46264 KB |
Output is correct |
8 |
Correct |
27 ms |
46220 KB |
Output is correct |
9 |
Correct |
25 ms |
46248 KB |
Output is correct |
10 |
Correct |
25 ms |
46164 KB |
Output is correct |
11 |
Correct |
24 ms |
46120 KB |
Output is correct |
12 |
Correct |
26 ms |
46168 KB |
Output is correct |
13 |
Correct |
31 ms |
46164 KB |
Output is correct |
14 |
Correct |
28 ms |
46168 KB |
Output is correct |
15 |
Correct |
28 ms |
46208 KB |
Output is correct |
16 |
Correct |
26 ms |
46292 KB |
Output is correct |
17 |
Correct |
27 ms |
46264 KB |
Output is correct |
18 |
Correct |
25 ms |
46204 KB |
Output is correct |
19 |
Correct |
29 ms |
46308 KB |
Output is correct |
20 |
Correct |
26 ms |
46288 KB |
Output is correct |
21 |
Correct |
26 ms |
46080 KB |
Output is correct |
22 |
Correct |
27 ms |
46196 KB |
Output is correct |
23 |
Correct |
27 ms |
46244 KB |
Output is correct |
24 |
Correct |
25 ms |
46292 KB |
Output is correct |
25 |
Correct |
28 ms |
46216 KB |
Output is correct |
26 |
Correct |
26 ms |
46120 KB |
Output is correct |
27 |
Correct |
29 ms |
46164 KB |
Output is correct |
28 |
Correct |
26 ms |
46116 KB |
Output is correct |
29 |
Correct |
25 ms |
46156 KB |
Output is correct |
30 |
Correct |
28 ms |
46180 KB |
Output is correct |
31 |
Correct |
934 ms |
70928 KB |
Output is correct |
32 |
Correct |
95 ms |
52088 KB |
Output is correct |
33 |
Correct |
219 ms |
57588 KB |
Output is correct |
34 |
Correct |
898 ms |
71540 KB |
Output is correct |
35 |
Correct |
975 ms |
71268 KB |
Output is correct |
36 |
Correct |
272 ms |
58188 KB |
Output is correct |
37 |
Correct |
214 ms |
57168 KB |
Output is correct |
38 |
Correct |
140 ms |
57084 KB |
Output is correct |
39 |
Correct |
123 ms |
56892 KB |
Output is correct |
40 |
Correct |
131 ms |
56828 KB |
Output is correct |
41 |
Correct |
617 ms |
71580 KB |
Output is correct |
42 |
Correct |
608 ms |
71284 KB |
Output is correct |
43 |
Correct |
67 ms |
53856 KB |
Output is correct |
44 |
Correct |
700 ms |
72036 KB |
Output is correct |
45 |
Correct |
736 ms |
72460 KB |
Output is correct |
46 |
Correct |
136 ms |
57004 KB |
Output is correct |
47 |
Correct |
102 ms |
56640 KB |
Output is correct |
48 |
Correct |
104 ms |
56576 KB |
Output is correct |
49 |
Correct |
125 ms |
56832 KB |
Output is correct |
50 |
Correct |
510 ms |
72216 KB |
Output is correct |
51 |
Correct |
111 ms |
56684 KB |
Output is correct |
52 |
Correct |
1104 ms |
108684 KB |
Output is correct |
53 |
Correct |
1730 ms |
99328 KB |
Output is correct |
54 |
Correct |
1057 ms |
108824 KB |
Output is correct |
55 |
Correct |
1120 ms |
108600 KB |
Output is correct |
56 |
Correct |
996 ms |
98812 KB |
Output is correct |
57 |
Correct |
1400 ms |
99340 KB |
Output is correct |
58 |
Correct |
1010 ms |
108608 KB |
Output is correct |
59 |
Correct |
1058 ms |
108664 KB |
Output is correct |
60 |
Correct |
1057 ms |
108608 KB |
Output is correct |
61 |
Correct |
1083 ms |
109132 KB |
Output is correct |
62 |
Correct |
1150 ms |
98976 KB |
Output is correct |
63 |
Correct |
745 ms |
109548 KB |
Output is correct |
64 |
Correct |
4240 ms |
144056 KB |
Output is correct |
65 |
Correct |
442 ms |
79552 KB |
Output is correct |
66 |
Correct |
1884 ms |
89028 KB |
Output is correct |
67 |
Correct |
1825 ms |
143416 KB |
Output is correct |
68 |
Correct |
2806 ms |
143372 KB |
Output is correct |
69 |
Correct |
2689 ms |
143452 KB |
Output is correct |
70 |
Correct |
920 ms |
88524 KB |
Output is correct |
71 |
Correct |
1270 ms |
88768 KB |
Output is correct |
72 |
Correct |
1622 ms |
135040 KB |
Output is correct |
73 |
Correct |
2346 ms |
138848 KB |
Output is correct |
74 |
Correct |
3187 ms |
142356 KB |
Output is correct |
75 |
Correct |
4029 ms |
145852 KB |
Output is correct |
76 |
Correct |
628 ms |
86256 KB |
Output is correct |
77 |
Correct |
557 ms |
85912 KB |
Output is correct |
78 |
Correct |
1022 ms |
87904 KB |
Output is correct |
79 |
Correct |
2539 ms |
143412 KB |
Output is correct |
80 |
Correct |
856 ms |
88304 KB |
Output is correct |
81 |
Correct |
308 ms |
68300 KB |
Output is correct |
82 |
Correct |
307 ms |
68812 KB |
Output is correct |
83 |
Correct |
485 ms |
67912 KB |
Output is correct |
84 |
Correct |
524 ms |
68856 KB |
Output is correct |
85 |
Correct |
436 ms |
67168 KB |
Output is correct |
86 |
Correct |
624 ms |
69144 KB |
Output is correct |
87 |
Correct |
486 ms |
69864 KB |
Output is correct |
88 |
Correct |
463 ms |
68732 KB |
Output is correct |
89 |
Correct |
569 ms |
69468 KB |
Output is correct |
90 |
Correct |
68 ms |
52552 KB |
Output is correct |
91 |
Correct |
313 ms |
67980 KB |
Output is correct |
92 |
Correct |
417 ms |
68708 KB |
Output is correct |
93 |
Correct |
438 ms |
69036 KB |
Output is correct |
94 |
Correct |
534 ms |
70312 KB |
Output is correct |
95 |
Correct |
640 ms |
69860 KB |
Output is correct |
96 |
Correct |
166 ms |
55124 KB |
Output is correct |
97 |
Correct |
2477 ms |
169568 KB |
Output is correct |
98 |
Correct |
484 ms |
72108 KB |
Output is correct |
99 |
Correct |
1856 ms |
89376 KB |
Output is correct |
100 |
Correct |
2470 ms |
184176 KB |
Output is correct |
101 |
Correct |
3880 ms |
183848 KB |
Output is correct |
102 |
Correct |
2292 ms |
106276 KB |
Output is correct |
103 |
Correct |
2266 ms |
101356 KB |
Output is correct |
104 |
Correct |
941 ms |
100708 KB |
Output is correct |
105 |
Correct |
822 ms |
99572 KB |
Output is correct |
106 |
Correct |
826 ms |
99584 KB |
Output is correct |
107 |
Correct |
4037 ms |
175252 KB |
Output is correct |
108 |
Correct |
3240 ms |
172520 KB |
Output is correct |
109 |
Correct |
4014 ms |
188152 KB |
Output is correct |
110 |
Correct |
3616 ms |
181768 KB |
Output is correct |
111 |
Correct |
3263 ms |
181388 KB |
Output is correct |
112 |
Correct |
4057 ms |
187356 KB |
Output is correct |
113 |
Correct |
246 ms |
85968 KB |
Output is correct |
114 |
Correct |
2319 ms |
173360 KB |
Output is correct |
115 |
Correct |
3501 ms |
180712 KB |
Output is correct |
116 |
Correct |
3526 ms |
178428 KB |
Output is correct |
117 |
Correct |
3886 ms |
183724 KB |
Output is correct |
118 |
Correct |
4210 ms |
188828 KB |
Output is correct |
119 |
Correct |
890 ms |
94516 KB |
Output is correct |
120 |
Correct |
414 ms |
97228 KB |
Output is correct |
121 |
Correct |
482 ms |
98656 KB |
Output is correct |
122 |
Correct |
469 ms |
98504 KB |
Output is correct |
123 |
Correct |
513 ms |
99184 KB |
Output is correct |
124 |
Correct |
3338 ms |
187532 KB |
Output is correct |
125 |
Correct |
491 ms |
99620 KB |
Output is correct |
126 |
Correct |
3018 ms |
183644 KB |
Output is correct |