#include "bits/stdc++.h"
using namespace std;
#define int long long
const int MAXN = 2.5e5 + 10;
const int MOD = 1e9 + 7;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
int u = uniform_int_distribution<int>(x, y)(rng);
return u;
}
int bm(int b, int p) { // bigmod
if(p==0) return 1;
int r = bm(b, p/2);
if(p&1) return (((r*r) % MOD) * b) % MOD;
return (r*r) % MOD;
}
int N, M, Q;
struct segtree_beats {
bool cmp(long long x, long long y) { return x > y; }
int stok;
const long long extr = 2e18;
struct node {
long long max1, max2, maxc;
long long min1, min2, minc;
long long lazy, sum;
long long l, r;
};
vector<node> a;
void pushtag_max(int idx, long long val) {
if(val >= a[idx].max1) return;
a[idx].sum -= (a[idx].max1 - val) * a[idx].maxc;
a[idx].max1 = val;
if(a[idx].l == a[idx].r) {
a[idx].min1 = val;
}
else {
if(a[idx].min1 >= val) {
a[idx].min1 = val;
a[idx].min2 = extr;
a[idx].minc = a[idx].r - a[idx].l + 1;
}
else if(a[idx].min2 > val && a[idx].min2 != extr) {
a[idx].min2 = val;
}
}
}
void pushtag_min(int idx, long long val) {
if(val <= a[idx].min1) return;
a[idx].sum += (val - a[idx].min1) * a[idx].minc;
a[idx].min1 = val;
if(a[idx].l == a[idx].r) {
a[idx].max1 = val;
}
else {
if(a[idx].max1 <= val) {
a[idx].max1 = val;
a[idx].max2 = -extr;
a[idx].maxc = a[idx].r - a[idx].l + 1;
}
else if(a[idx].max2 < val && a[idx].max2 != -extr) {
a[idx].max2 = val;
}
}
}
void pushtag_add(int idx, long long val) {
a[idx].max1 += val;
if(a[idx].max2 != -extr) a[idx].max2 += val;
a[idx].min1 += val;
if(a[idx].min2 != extr) a[idx].min2 += val;
a[idx].lazy += val;
a[idx].sum += val * (a[idx].r - a[idx].l + 1);
}
void pushdown(int idx) {
pushtag_add(2*idx+1, a[idx].lazy);
pushtag_add(2*idx+2, a[idx].lazy);
a[idx].lazy = 0;
pushtag_max(2*idx+1, a[idx].max1);
pushtag_max(2*idx+2, a[idx].max1);
pushtag_min(2*idx+1, a[idx].min1);
pushtag_min(2*idx+2, a[idx].min1);
}
void pushup(int idx) {
long long max1, max2, maxc;
long long min1, min2, minc;
long long lazy, sum;
long long l, r;
a[idx].max1 = max(a[2*idx+1].max1, a[2*idx+2].max1);
a[idx].max2 = (a[2*idx+1].max1 == a[2*idx+2].max1 ?
max(a[2*idx+1].max2, a[2*idx+2].max2) :
(a[2*idx+1].max1 < a[2*idx+2].max1 ?
max(a[2*idx+1].max1, a[2*idx+2].max2) :
max(a[2*idx+1].max2, a[2*idx+2].max1)
));
a[idx].maxc = (a[2*idx+1].max1 == a[2*idx+2].max1 ?
a[2*idx+1].maxc + a[2*idx+2].maxc :
(a[2*idx+1].max1 < a[2*idx+2].max1 ?
a[2*idx+2].maxc :
a[2*idx+1].maxc)
);
a[idx].min1 = min(a[2*idx+1].min1, a[2*idx+2].min1);
a[idx].min2 = (a[2*idx+1].min1 == a[2*idx+2].min1 ?
min(a[2*idx+1].min2, a[2*idx+2].min2) :
(a[2*idx+1].min1 > a[2*idx+2].min1 ?
min(a[2*idx+1].min1, a[2*idx+2].min2) :
min(a[2*idx+1].min2, a[2*idx+2].min1)
));
a[idx].minc = (a[2*idx+1].min1 == a[2*idx+2].min1 ?
a[2*idx+1].minc + a[2*idx+2].minc :
(a[2*idx+1].min1 > a[2*idx+2].min1 ?
a[2*idx+2].minc :
a[2*idx+1].minc)
);
a[idx].sum = a[2*idx+1].sum + a[2*idx+2].sum;
}
void init1(int l, int r, int idx, long long val) {
a[idx].l = l, a[idx].r = r;
if(l == r) {
a[idx].max1 = a[idx].min1 = val;
a[idx].max2 = -extr;
a[idx].min2 = extr;
a[idx].maxc = a[idx].minc = 1;
a[idx].lazy = 0;
a[idx].sum = val;
return;
}
int mid = (l+r) >> 1;
init1(l, mid, 2*idx+1, val);
init1(mid+1, r, 2*idx+2, val);
pushup(idx);
}
void u1(int l, int r, int constl, int constr, int idx, long long v) {
if(v >= a[idx].max1) return;
if(l<=constl && constr<=r && v>a[idx].max2) {
pushtag_max(idx, v);
return;
}
pushdown(idx);
int mid = (constl+constr) >> 1;
if(mid < l || r < constl) u1(l, r, mid+1, constr, 2*idx+2, v);
else if(constr < l || r < mid+1) u1(l, r, constl, mid, 2*idx+1, v);
else {
u1(l, r, constl, mid, 2*idx+1, v);
u1(l, r, mid+1, constr, 2*idx+2, v);
}
pushup(idx);
}
void u2(int l, int r, int constl, int constr, int idx, long long v) {
if(v <= a[idx].min1) return;
if(l<=constl && constr<=r && v<a[idx].min2) {
pushtag_min(idx, v);
return;
}
pushdown(idx);
int mid = (constl+constr) >> 1;
if(mid < l || r < constl) u2(l, r, mid+1, constr, 2*idx+2, v);
else if(constr < l || r < mid+1) u2(l, r, constl, mid, 2*idx+1, v);
else {
u2(l, r, constl, mid, 2*idx+1, v);
u2(l, r, mid+1, constr, 2*idx+2, v);
}
pushup(idx);
}
void u3(int l, int r, int constl, int constr, int idx, long long v) {
if(l <= constl && constr <= r) {
pushtag_add(idx, v);
return;
}
pushdown(idx);
int mid = (constl+constr) >> 1;
if(mid < l || r < constl) u3(l, r, mid+1, constr, 2*idx+2, v);
else if(constr < l || r < mid+1) u3(l, r, constl, mid, 2*idx+1, v);
else {
u3(l, r, constl, mid, 2*idx+1, v);
u3(l, r, mid+1, constr, 2*idx+2, v);
}
pushup(idx);
}
long long qu(int l, int r, int constl, int constr, int idx) {
if(l <= constl && constr <= r) {
return a[idx].sum;
}
pushdown(idx);
int mid = (constl+constr) >> 1;
if(mid < l || r < constl) return qu(l, r, mid+1, constr, 2*idx+2);
else if(constr < l || r < mid+1) return qu(l, r, constl, mid, 2*idx+1);
else {
return qu(l, r, constl, mid, 2*idx+1) + qu(l, r, mid+1, constr, 2*idx+2);
}
}
public:
void resize(int k) {
stok = k;
a.resize(4*k + 10);
}
void init(long long v) { // Initialize everything to v
init1(0, stok, 0, v);
}
void min_with(int l, int r, long long v) {
u1(l, r, 0, stok, 0, v);
}
void max_with(int l, int r, long long v) {
u2(l, r, 0, stok, 0, v);
}
void range_add(int l, int r, long long v) {
u3(l, r, 0, stok, 0, v);
}
long long query_sum(int l, int r) {
return (long long)qu(l, r, 0, stok, 0);
}
};
struct _1m {
segtree_beats a;
public:
void join(int l, int r, int c, int k) {
a.range_add(l, r, k);
}
void leave(int l, int r, int k) {
a.range_add(l, r, -k);
a.max_with(l, r, 0);
}
int service(int shop, int b) {
return (a.query_sum(shop, shop) >= b ? 1 : 0);
}
};
void solve_1m() {
_1m ar;
ar.a.resize(N);
ar.a.init(0);
while(Q--) {
int t;
scanf("%d", &t);
//cin >> t;
if(t == 1) {
int l, r, c, k;
scanf("%lld %lld %lld %lld", &l, &r, &c, &k);
//cin >> l >> r >> c >> k;
ar.join(l, r, c, k);
}
else if(t == 2) {
int l, r, k;
scanf("%lld %lld %lld", &l, &r, &k);
//cin >> l >> r >> k;
ar.leave(l, r, k);
}
else {
int a, b;
scanf("%lld %lld", &a, &b);
//cin >> a >> b;
cout << ar.service(a, b) << "\n";
}
}
}
segtree_beats stb;
vector<pair<int, pair<int, int> > > v[4*MAXN];
vector<int> w[4*MAXN];
int p[4*MAXN];
int ti=0;
int rp[MAXN];
void update(int l, int r, int constl, int constr, int idx, int c, int k) {
if(l<=constl && constr<=r) {
v[idx].push_back({ti, {c, k}});
w[idx].push_back(w[idx].empty() ? k : w[idx][w[idx].size() - 1] + k);
return;
}
int mid = (constl+constr) >> 1;
if(mid < l || r < constl) update(l, r, mid+1, constr, 2*idx+2, c, k);
else if(constr < l || r < mid+1) update(l, r, constl, mid, 2*idx+1, c, k);
else {
update(l, r, constl, mid, 2*idx+1, c, k);
update(l, r, mid+1, constr, 2*idx+2, c, k);
}
}
void build(int l, int r, int idx) {
if(l == r) {
rp[l] = idx;
return;
}
int mid = (l+r) >> 1;
build(l, mid, 2*idx+1);
build(mid+1, r, 2*idx+2);
p[2*idx+1] = p[2*idx+2] = idx;
}
void join(int l, int r, int c, int k) {
ti++;
stb.range_add(l, r, k);
update(l, r, 0, MAXN-1, 0, c, k);
}
void leave(int l, int r, int k) {
stb.range_add(l, r, -k);
stb.max_with(l, r, 0);
}
int service(int a, int b) { // log^3 n
int cur = rp[a];
vector<int> q;
int sum = 0;
while(1) {
q.push_back(cur);
if(w[cur].size()) sum += w[cur][w[cur].size() - 1];
if(cur == 0) break;
cur = p[cur];
}
b += sum - stb.query_sum(a, a);
if(b > sum) return 0;
int lb = 0, rb = ti;
while(lb < rb) { // log n
int mid = (lb+rb) >> 1;
int tot = 0;
for(int x: q) { // log n
if(w[x].empty()) continue;
int lb2 = 0, rb2 = w[x].size() - 1;
while(lb2 < rb2) { // log n
int mid2 = (lb2 + rb2 + 1) >> 1;
if(v[x][mid2].first <= mid) {
lb2 = mid2;
}
else {
rb2 = mid2 - 1;
}
}
if(v[x][lb2].first <= mid) {
tot += w[x][lb2];
}
}
if(tot >= b) rb = mid;
else lb = mid + 1;
}
for(int x: q) {
if(w[x].empty()) continue;
int lb2 = 0, rb2 = w[x].size() - 1;
while(lb2 < rb2) { // log n
int mid2 = (lb2 + rb2 + 1) >> 1;
if(v[x][mid2].first <= lb) {
lb2 = mid2;
}
else {
rb2 = mid2 - 1;
}
}
if(v[x][lb2].first == lb) {
return v[x][lb2].second.first;
}
}
}
void solve(int tc) {
scanf("%lld %lld %lld", &N, &M, &Q);
// cin >> N >> M >> Q;
if(M == 1) { // Subtask 4
solve_1m();
return;
}
stb.resize(N);
stb.init(0);
build(0, MAXN-1, 0);
while(Q--) {
int t;
scanf("%lld", &t);
//cin >> t;
if(t == 1) {
int l, r, c, k;
scanf("%lld %lld %lld %lld", &l, &r, &c, &k);
//cin >> l >> r >> c >> k;
join(l, r, c, k);
}
else if(t == 2) {
int l, r, k;
scanf("%lld %lld %lld", &l, &r, &k);
//cin >> l >> r >> k;
leave(l, r, k);
}
else {
int a, b;
scanf("%lld %lld", &a, &b);
//cin >> a >> b;
cout << service(a, b) << "\n";
}
}
}
int32_t main(){
ios::sync_with_stdio(0); cin.tie(0);
int t = 1; //cin >> t;
for(int i=1; i<=t; i++) {
solve(i);
}
}
Compilation message
foodcourt.cpp: In member function 'void segtree_beats::pushup(long long int)':
foodcourt.cpp:85:19: warning: unused variable 'max1' [-Wunused-variable]
85 | long long max1, max2, maxc;
| ^~~~
foodcourt.cpp:85:25: warning: unused variable 'max2' [-Wunused-variable]
85 | long long max1, max2, maxc;
| ^~~~
foodcourt.cpp:85:31: warning: unused variable 'maxc' [-Wunused-variable]
85 | long long max1, max2, maxc;
| ^~~~
foodcourt.cpp:86:19: warning: unused variable 'min1' [-Wunused-variable]
86 | long long min1, min2, minc;
| ^~~~
foodcourt.cpp:86:25: warning: unused variable 'min2' [-Wunused-variable]
86 | long long min1, min2, minc;
| ^~~~
foodcourt.cpp:86:31: warning: unused variable 'minc' [-Wunused-variable]
86 | long long min1, min2, minc;
| ^~~~
foodcourt.cpp:87:19: warning: unused variable 'lazy' [-Wunused-variable]
87 | long long lazy, sum;
| ^~~~
foodcourt.cpp:87:25: warning: unused variable 'sum' [-Wunused-variable]
87 | long long lazy, sum;
| ^~~
foodcourt.cpp:88:19: warning: unused variable 'l' [-Wunused-variable]
88 | long long l, r;
| ^
foodcourt.cpp:88:22: warning: unused variable 'r' [-Wunused-variable]
88 | long long l, r;
| ^
foodcourt.cpp: In function 'void solve_1m()':
foodcourt.cpp:234:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
234 | scanf("%d", &t);
| ~^ ~~
| | |
| | long long int*
| int*
| %lld
foodcourt.cpp:234:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
234 | scanf("%d", &t);
| ~~~~~^~~~~~~~~~
foodcourt.cpp:238:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
238 | scanf("%lld %lld %lld %lld", &l, &r, &c, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:244:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
244 | scanf("%lld %lld %lld", &l, &r, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:250:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
250 | scanf("%lld %lld", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'long long int service(long long int, long long int)':
foodcourt.cpp:297:17: warning: control reaches end of non-void function [-Wreturn-type]
297 | vector<int> q;
| ^
foodcourt.cpp: In function 'void solve(long long int)':
foodcourt.cpp:349:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
349 | scanf("%lld %lld %lld", &N, &M, &Q);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:360:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
360 | scanf("%lld", &t);
| ~~~~~^~~~~~~~~~~~
foodcourt.cpp:364:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
364 | scanf("%lld %lld %lld %lld", &l, &r, &c, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:370:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
370 | scanf("%lld %lld %lld", &l, &r, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:376:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
376 | scanf("%lld %lld", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
53956 KB |
Output is correct |
2 |
Correct |
34 ms |
54220 KB |
Output is correct |
3 |
Correct |
27 ms |
54256 KB |
Output is correct |
4 |
Correct |
29 ms |
54428 KB |
Output is correct |
5 |
Correct |
27 ms |
53372 KB |
Output is correct |
6 |
Correct |
26 ms |
53380 KB |
Output is correct |
7 |
Correct |
33 ms |
54232 KB |
Output is correct |
8 |
Correct |
32 ms |
54320 KB |
Output is correct |
9 |
Correct |
35 ms |
54280 KB |
Output is correct |
10 |
Correct |
29 ms |
54252 KB |
Output is correct |
11 |
Correct |
29 ms |
54244 KB |
Output is correct |
12 |
Correct |
29 ms |
54244 KB |
Output is correct |
13 |
Correct |
27 ms |
54400 KB |
Output is correct |
14 |
Correct |
27 ms |
54348 KB |
Output is correct |
15 |
Correct |
27 ms |
54188 KB |
Output is correct |
16 |
Correct |
26 ms |
54408 KB |
Output is correct |
17 |
Correct |
28 ms |
53992 KB |
Output is correct |
18 |
Correct |
40 ms |
54232 KB |
Output is correct |
19 |
Correct |
28 ms |
53992 KB |
Output is correct |
20 |
Correct |
30 ms |
54204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
53956 KB |
Output is correct |
2 |
Correct |
34 ms |
54220 KB |
Output is correct |
3 |
Correct |
27 ms |
54256 KB |
Output is correct |
4 |
Correct |
29 ms |
54428 KB |
Output is correct |
5 |
Correct |
27 ms |
53372 KB |
Output is correct |
6 |
Correct |
26 ms |
53380 KB |
Output is correct |
7 |
Correct |
33 ms |
54232 KB |
Output is correct |
8 |
Correct |
32 ms |
54320 KB |
Output is correct |
9 |
Correct |
35 ms |
54280 KB |
Output is correct |
10 |
Correct |
29 ms |
54252 KB |
Output is correct |
11 |
Correct |
29 ms |
54244 KB |
Output is correct |
12 |
Correct |
29 ms |
54244 KB |
Output is correct |
13 |
Correct |
27 ms |
54400 KB |
Output is correct |
14 |
Correct |
27 ms |
54348 KB |
Output is correct |
15 |
Correct |
27 ms |
54188 KB |
Output is correct |
16 |
Correct |
26 ms |
54408 KB |
Output is correct |
17 |
Correct |
28 ms |
53992 KB |
Output is correct |
18 |
Correct |
40 ms |
54232 KB |
Output is correct |
19 |
Correct |
28 ms |
53992 KB |
Output is correct |
20 |
Correct |
30 ms |
54204 KB |
Output is correct |
21 |
Correct |
32 ms |
54128 KB |
Output is correct |
22 |
Correct |
30 ms |
54188 KB |
Output is correct |
23 |
Correct |
29 ms |
54116 KB |
Output is correct |
24 |
Correct |
30 ms |
54464 KB |
Output is correct |
25 |
Correct |
26 ms |
53404 KB |
Output is correct |
26 |
Correct |
29 ms |
53368 KB |
Output is correct |
27 |
Correct |
32 ms |
54296 KB |
Output is correct |
28 |
Correct |
31 ms |
54312 KB |
Output is correct |
29 |
Correct |
31 ms |
54288 KB |
Output is correct |
30 |
Correct |
31 ms |
54236 KB |
Output is correct |
31 |
Correct |
31 ms |
54220 KB |
Output is correct |
32 |
Correct |
31 ms |
54220 KB |
Output is correct |
33 |
Correct |
32 ms |
54372 KB |
Output is correct |
34 |
Correct |
31 ms |
54428 KB |
Output is correct |
35 |
Correct |
31 ms |
54168 KB |
Output is correct |
36 |
Correct |
30 ms |
54348 KB |
Output is correct |
37 |
Correct |
29 ms |
53964 KB |
Output is correct |
38 |
Correct |
31 ms |
54176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
182 ms |
76912 KB |
Output is correct |
2 |
Correct |
204 ms |
78428 KB |
Output is correct |
3 |
Correct |
193 ms |
77848 KB |
Output is correct |
4 |
Correct |
195 ms |
77868 KB |
Output is correct |
5 |
Correct |
206 ms |
79692 KB |
Output is correct |
6 |
Correct |
213 ms |
79792 KB |
Output is correct |
7 |
Correct |
64 ms |
54424 KB |
Output is correct |
8 |
Correct |
66 ms |
54980 KB |
Output is correct |
9 |
Correct |
191 ms |
77228 KB |
Output is correct |
10 |
Correct |
195 ms |
77252 KB |
Output is correct |
11 |
Correct |
187 ms |
77308 KB |
Output is correct |
12 |
Correct |
197 ms |
77380 KB |
Output is correct |
13 |
Correct |
166 ms |
71784 KB |
Output is correct |
14 |
Correct |
190 ms |
79172 KB |
Output is correct |
15 |
Correct |
188 ms |
74452 KB |
Output is correct |
16 |
Correct |
197 ms |
81204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
509 ms |
118000 KB |
Output is correct |
2 |
Correct |
477 ms |
108744 KB |
Output is correct |
3 |
Correct |
544 ms |
126472 KB |
Output is correct |
4 |
Correct |
364 ms |
125380 KB |
Output is correct |
5 |
Correct |
362 ms |
106412 KB |
Output is correct |
6 |
Correct |
480 ms |
126080 KB |
Output is correct |
7 |
Correct |
128 ms |
47780 KB |
Output is correct |
8 |
Correct |
125 ms |
47760 KB |
Output is correct |
9 |
Correct |
420 ms |
126172 KB |
Output is correct |
10 |
Correct |
426 ms |
126252 KB |
Output is correct |
11 |
Correct |
528 ms |
126092 KB |
Output is correct |
12 |
Correct |
514 ms |
126028 KB |
Output is correct |
13 |
Correct |
496 ms |
126004 KB |
Output is correct |
14 |
Correct |
534 ms |
126112 KB |
Output is correct |
15 |
Correct |
608 ms |
126144 KB |
Output is correct |
16 |
Correct |
586 ms |
126144 KB |
Output is correct |
17 |
Correct |
562 ms |
126128 KB |
Output is correct |
18 |
Correct |
547 ms |
126060 KB |
Output is correct |
19 |
Correct |
550 ms |
126052 KB |
Output is correct |
20 |
Correct |
546 ms |
126020 KB |
Output is correct |
21 |
Correct |
590 ms |
126192 KB |
Output is correct |
22 |
Correct |
563 ms |
125996 KB |
Output is correct |
23 |
Correct |
548 ms |
126132 KB |
Output is correct |
24 |
Correct |
577 ms |
126060 KB |
Output is correct |
25 |
Correct |
387 ms |
108280 KB |
Output is correct |
26 |
Correct |
406 ms |
126220 KB |
Output is correct |
27 |
Correct |
444 ms |
125980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
53956 KB |
Output is correct |
2 |
Correct |
34 ms |
54220 KB |
Output is correct |
3 |
Correct |
27 ms |
54256 KB |
Output is correct |
4 |
Correct |
29 ms |
54428 KB |
Output is correct |
5 |
Correct |
27 ms |
53372 KB |
Output is correct |
6 |
Correct |
26 ms |
53380 KB |
Output is correct |
7 |
Correct |
33 ms |
54232 KB |
Output is correct |
8 |
Correct |
32 ms |
54320 KB |
Output is correct |
9 |
Correct |
35 ms |
54280 KB |
Output is correct |
10 |
Correct |
29 ms |
54252 KB |
Output is correct |
11 |
Correct |
29 ms |
54244 KB |
Output is correct |
12 |
Correct |
29 ms |
54244 KB |
Output is correct |
13 |
Correct |
27 ms |
54400 KB |
Output is correct |
14 |
Correct |
27 ms |
54348 KB |
Output is correct |
15 |
Correct |
27 ms |
54188 KB |
Output is correct |
16 |
Correct |
26 ms |
54408 KB |
Output is correct |
17 |
Correct |
28 ms |
53992 KB |
Output is correct |
18 |
Correct |
40 ms |
54232 KB |
Output is correct |
19 |
Correct |
28 ms |
53992 KB |
Output is correct |
20 |
Correct |
30 ms |
54204 KB |
Output is correct |
21 |
Correct |
182 ms |
76912 KB |
Output is correct |
22 |
Correct |
204 ms |
78428 KB |
Output is correct |
23 |
Correct |
193 ms |
77848 KB |
Output is correct |
24 |
Correct |
195 ms |
77868 KB |
Output is correct |
25 |
Correct |
206 ms |
79692 KB |
Output is correct |
26 |
Correct |
213 ms |
79792 KB |
Output is correct |
27 |
Correct |
64 ms |
54424 KB |
Output is correct |
28 |
Correct |
66 ms |
54980 KB |
Output is correct |
29 |
Correct |
191 ms |
77228 KB |
Output is correct |
30 |
Correct |
195 ms |
77252 KB |
Output is correct |
31 |
Correct |
187 ms |
77308 KB |
Output is correct |
32 |
Correct |
197 ms |
77380 KB |
Output is correct |
33 |
Correct |
166 ms |
71784 KB |
Output is correct |
34 |
Correct |
190 ms |
79172 KB |
Output is correct |
35 |
Correct |
188 ms |
74452 KB |
Output is correct |
36 |
Correct |
197 ms |
81204 KB |
Output is correct |
37 |
Correct |
274 ms |
84248 KB |
Output is correct |
38 |
Correct |
245 ms |
88552 KB |
Output is correct |
39 |
Correct |
59 ms |
54400 KB |
Output is correct |
40 |
Correct |
65 ms |
55044 KB |
Output is correct |
41 |
Correct |
298 ms |
89612 KB |
Output is correct |
42 |
Correct |
296 ms |
89700 KB |
Output is correct |
43 |
Correct |
304 ms |
89836 KB |
Output is correct |
44 |
Correct |
301 ms |
89524 KB |
Output is correct |
45 |
Correct |
297 ms |
89620 KB |
Output is correct |
46 |
Correct |
304 ms |
89788 KB |
Output is correct |
47 |
Correct |
139 ms |
90392 KB |
Output is correct |
48 |
Correct |
179 ms |
88000 KB |
Output is correct |
49 |
Correct |
220 ms |
78952 KB |
Output is correct |
50 |
Correct |
268 ms |
87620 KB |
Output is correct |
51 |
Correct |
318 ms |
90556 KB |
Output is correct |
52 |
Correct |
342 ms |
90240 KB |
Output is correct |
53 |
Correct |
161 ms |
77052 KB |
Output is correct |
54 |
Correct |
205 ms |
81292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
367 ms |
91076 KB |
Output is correct |
2 |
Correct |
396 ms |
89768 KB |
Output is correct |
3 |
Correct |
421 ms |
93824 KB |
Output is correct |
4 |
Correct |
287 ms |
87668 KB |
Output is correct |
5 |
Correct |
365 ms |
91516 KB |
Output is correct |
6 |
Correct |
427 ms |
94708 KB |
Output is correct |
7 |
Correct |
85 ms |
54616 KB |
Output is correct |
8 |
Correct |
84 ms |
55248 KB |
Output is correct |
9 |
Correct |
188 ms |
97104 KB |
Output is correct |
10 |
Correct |
157 ms |
88040 KB |
Output is correct |
11 |
Correct |
211 ms |
94252 KB |
Output is correct |
12 |
Correct |
218 ms |
94164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
53956 KB |
Output is correct |
2 |
Correct |
34 ms |
54220 KB |
Output is correct |
3 |
Correct |
27 ms |
54256 KB |
Output is correct |
4 |
Correct |
29 ms |
54428 KB |
Output is correct |
5 |
Correct |
27 ms |
53372 KB |
Output is correct |
6 |
Correct |
26 ms |
53380 KB |
Output is correct |
7 |
Correct |
33 ms |
54232 KB |
Output is correct |
8 |
Correct |
32 ms |
54320 KB |
Output is correct |
9 |
Correct |
35 ms |
54280 KB |
Output is correct |
10 |
Correct |
29 ms |
54252 KB |
Output is correct |
11 |
Correct |
29 ms |
54244 KB |
Output is correct |
12 |
Correct |
29 ms |
54244 KB |
Output is correct |
13 |
Correct |
27 ms |
54400 KB |
Output is correct |
14 |
Correct |
27 ms |
54348 KB |
Output is correct |
15 |
Correct |
27 ms |
54188 KB |
Output is correct |
16 |
Correct |
26 ms |
54408 KB |
Output is correct |
17 |
Correct |
28 ms |
53992 KB |
Output is correct |
18 |
Correct |
40 ms |
54232 KB |
Output is correct |
19 |
Correct |
28 ms |
53992 KB |
Output is correct |
20 |
Correct |
30 ms |
54204 KB |
Output is correct |
21 |
Correct |
32 ms |
54128 KB |
Output is correct |
22 |
Correct |
30 ms |
54188 KB |
Output is correct |
23 |
Correct |
29 ms |
54116 KB |
Output is correct |
24 |
Correct |
30 ms |
54464 KB |
Output is correct |
25 |
Correct |
26 ms |
53404 KB |
Output is correct |
26 |
Correct |
29 ms |
53368 KB |
Output is correct |
27 |
Correct |
32 ms |
54296 KB |
Output is correct |
28 |
Correct |
31 ms |
54312 KB |
Output is correct |
29 |
Correct |
31 ms |
54288 KB |
Output is correct |
30 |
Correct |
31 ms |
54236 KB |
Output is correct |
31 |
Correct |
31 ms |
54220 KB |
Output is correct |
32 |
Correct |
31 ms |
54220 KB |
Output is correct |
33 |
Correct |
32 ms |
54372 KB |
Output is correct |
34 |
Correct |
31 ms |
54428 KB |
Output is correct |
35 |
Correct |
31 ms |
54168 KB |
Output is correct |
36 |
Correct |
30 ms |
54348 KB |
Output is correct |
37 |
Correct |
29 ms |
53964 KB |
Output is correct |
38 |
Correct |
31 ms |
54176 KB |
Output is correct |
39 |
Correct |
182 ms |
76912 KB |
Output is correct |
40 |
Correct |
204 ms |
78428 KB |
Output is correct |
41 |
Correct |
193 ms |
77848 KB |
Output is correct |
42 |
Correct |
195 ms |
77868 KB |
Output is correct |
43 |
Correct |
206 ms |
79692 KB |
Output is correct |
44 |
Correct |
213 ms |
79792 KB |
Output is correct |
45 |
Correct |
64 ms |
54424 KB |
Output is correct |
46 |
Correct |
66 ms |
54980 KB |
Output is correct |
47 |
Correct |
191 ms |
77228 KB |
Output is correct |
48 |
Correct |
195 ms |
77252 KB |
Output is correct |
49 |
Correct |
187 ms |
77308 KB |
Output is correct |
50 |
Correct |
197 ms |
77380 KB |
Output is correct |
51 |
Correct |
166 ms |
71784 KB |
Output is correct |
52 |
Correct |
190 ms |
79172 KB |
Output is correct |
53 |
Correct |
188 ms |
74452 KB |
Output is correct |
54 |
Correct |
197 ms |
81204 KB |
Output is correct |
55 |
Correct |
274 ms |
84248 KB |
Output is correct |
56 |
Correct |
245 ms |
88552 KB |
Output is correct |
57 |
Correct |
59 ms |
54400 KB |
Output is correct |
58 |
Correct |
65 ms |
55044 KB |
Output is correct |
59 |
Correct |
298 ms |
89612 KB |
Output is correct |
60 |
Correct |
296 ms |
89700 KB |
Output is correct |
61 |
Correct |
304 ms |
89836 KB |
Output is correct |
62 |
Correct |
301 ms |
89524 KB |
Output is correct |
63 |
Correct |
297 ms |
89620 KB |
Output is correct |
64 |
Correct |
304 ms |
89788 KB |
Output is correct |
65 |
Correct |
139 ms |
90392 KB |
Output is correct |
66 |
Correct |
179 ms |
88000 KB |
Output is correct |
67 |
Correct |
220 ms |
78952 KB |
Output is correct |
68 |
Correct |
268 ms |
87620 KB |
Output is correct |
69 |
Correct |
318 ms |
90556 KB |
Output is correct |
70 |
Correct |
342 ms |
90240 KB |
Output is correct |
71 |
Correct |
161 ms |
77052 KB |
Output is correct |
72 |
Correct |
205 ms |
81292 KB |
Output is correct |
73 |
Correct |
367 ms |
91076 KB |
Output is correct |
74 |
Correct |
396 ms |
89768 KB |
Output is correct |
75 |
Correct |
421 ms |
93824 KB |
Output is correct |
76 |
Correct |
287 ms |
87668 KB |
Output is correct |
77 |
Correct |
365 ms |
91516 KB |
Output is correct |
78 |
Correct |
427 ms |
94708 KB |
Output is correct |
79 |
Correct |
85 ms |
54616 KB |
Output is correct |
80 |
Correct |
84 ms |
55248 KB |
Output is correct |
81 |
Correct |
188 ms |
97104 KB |
Output is correct |
82 |
Correct |
157 ms |
88040 KB |
Output is correct |
83 |
Correct |
211 ms |
94252 KB |
Output is correct |
84 |
Correct |
218 ms |
94164 KB |
Output is correct |
85 |
Correct |
276 ms |
81556 KB |
Output is correct |
86 |
Correct |
340 ms |
87616 KB |
Output is correct |
87 |
Correct |
283 ms |
90932 KB |
Output is correct |
88 |
Correct |
334 ms |
94708 KB |
Output is correct |
89 |
Correct |
208 ms |
79968 KB |
Output is correct |
90 |
Correct |
306 ms |
89740 KB |
Output is correct |
91 |
Correct |
239 ms |
79712 KB |
Output is correct |
92 |
Correct |
226 ms |
79104 KB |
Output is correct |
93 |
Correct |
303 ms |
89636 KB |
Output is correct |
94 |
Correct |
307 ms |
89804 KB |
Output is correct |
95 |
Correct |
284 ms |
87372 KB |
Output is correct |
96 |
Correct |
307 ms |
89776 KB |
Output is correct |
97 |
Correct |
332 ms |
89752 KB |
Output is correct |
98 |
Correct |
279 ms |
81064 KB |
Output is correct |
99 |
Correct |
165 ms |
90488 KB |
Output is correct |
100 |
Correct |
160 ms |
82892 KB |
Output is correct |
101 |
Correct |
184 ms |
87976 KB |
Output is correct |
102 |
Correct |
234 ms |
83924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
53956 KB |
Output is correct |
2 |
Correct |
34 ms |
54220 KB |
Output is correct |
3 |
Correct |
27 ms |
54256 KB |
Output is correct |
4 |
Correct |
29 ms |
54428 KB |
Output is correct |
5 |
Correct |
27 ms |
53372 KB |
Output is correct |
6 |
Correct |
26 ms |
53380 KB |
Output is correct |
7 |
Correct |
33 ms |
54232 KB |
Output is correct |
8 |
Correct |
32 ms |
54320 KB |
Output is correct |
9 |
Correct |
35 ms |
54280 KB |
Output is correct |
10 |
Correct |
29 ms |
54252 KB |
Output is correct |
11 |
Correct |
29 ms |
54244 KB |
Output is correct |
12 |
Correct |
29 ms |
54244 KB |
Output is correct |
13 |
Correct |
27 ms |
54400 KB |
Output is correct |
14 |
Correct |
27 ms |
54348 KB |
Output is correct |
15 |
Correct |
27 ms |
54188 KB |
Output is correct |
16 |
Correct |
26 ms |
54408 KB |
Output is correct |
17 |
Correct |
28 ms |
53992 KB |
Output is correct |
18 |
Correct |
40 ms |
54232 KB |
Output is correct |
19 |
Correct |
28 ms |
53992 KB |
Output is correct |
20 |
Correct |
30 ms |
54204 KB |
Output is correct |
21 |
Correct |
32 ms |
54128 KB |
Output is correct |
22 |
Correct |
30 ms |
54188 KB |
Output is correct |
23 |
Correct |
29 ms |
54116 KB |
Output is correct |
24 |
Correct |
30 ms |
54464 KB |
Output is correct |
25 |
Correct |
26 ms |
53404 KB |
Output is correct |
26 |
Correct |
29 ms |
53368 KB |
Output is correct |
27 |
Correct |
32 ms |
54296 KB |
Output is correct |
28 |
Correct |
31 ms |
54312 KB |
Output is correct |
29 |
Correct |
31 ms |
54288 KB |
Output is correct |
30 |
Correct |
31 ms |
54236 KB |
Output is correct |
31 |
Correct |
31 ms |
54220 KB |
Output is correct |
32 |
Correct |
31 ms |
54220 KB |
Output is correct |
33 |
Correct |
32 ms |
54372 KB |
Output is correct |
34 |
Correct |
31 ms |
54428 KB |
Output is correct |
35 |
Correct |
31 ms |
54168 KB |
Output is correct |
36 |
Correct |
30 ms |
54348 KB |
Output is correct |
37 |
Correct |
29 ms |
53964 KB |
Output is correct |
38 |
Correct |
31 ms |
54176 KB |
Output is correct |
39 |
Correct |
182 ms |
76912 KB |
Output is correct |
40 |
Correct |
204 ms |
78428 KB |
Output is correct |
41 |
Correct |
193 ms |
77848 KB |
Output is correct |
42 |
Correct |
195 ms |
77868 KB |
Output is correct |
43 |
Correct |
206 ms |
79692 KB |
Output is correct |
44 |
Correct |
213 ms |
79792 KB |
Output is correct |
45 |
Correct |
64 ms |
54424 KB |
Output is correct |
46 |
Correct |
66 ms |
54980 KB |
Output is correct |
47 |
Correct |
191 ms |
77228 KB |
Output is correct |
48 |
Correct |
195 ms |
77252 KB |
Output is correct |
49 |
Correct |
187 ms |
77308 KB |
Output is correct |
50 |
Correct |
197 ms |
77380 KB |
Output is correct |
51 |
Correct |
166 ms |
71784 KB |
Output is correct |
52 |
Correct |
190 ms |
79172 KB |
Output is correct |
53 |
Correct |
188 ms |
74452 KB |
Output is correct |
54 |
Correct |
197 ms |
81204 KB |
Output is correct |
55 |
Correct |
509 ms |
118000 KB |
Output is correct |
56 |
Correct |
477 ms |
108744 KB |
Output is correct |
57 |
Correct |
544 ms |
126472 KB |
Output is correct |
58 |
Correct |
364 ms |
125380 KB |
Output is correct |
59 |
Correct |
362 ms |
106412 KB |
Output is correct |
60 |
Correct |
480 ms |
126080 KB |
Output is correct |
61 |
Correct |
128 ms |
47780 KB |
Output is correct |
62 |
Correct |
125 ms |
47760 KB |
Output is correct |
63 |
Correct |
420 ms |
126172 KB |
Output is correct |
64 |
Correct |
426 ms |
126252 KB |
Output is correct |
65 |
Correct |
528 ms |
126092 KB |
Output is correct |
66 |
Correct |
514 ms |
126028 KB |
Output is correct |
67 |
Correct |
496 ms |
126004 KB |
Output is correct |
68 |
Correct |
534 ms |
126112 KB |
Output is correct |
69 |
Correct |
608 ms |
126144 KB |
Output is correct |
70 |
Correct |
586 ms |
126144 KB |
Output is correct |
71 |
Correct |
562 ms |
126128 KB |
Output is correct |
72 |
Correct |
547 ms |
126060 KB |
Output is correct |
73 |
Correct |
550 ms |
126052 KB |
Output is correct |
74 |
Correct |
546 ms |
126020 KB |
Output is correct |
75 |
Correct |
590 ms |
126192 KB |
Output is correct |
76 |
Correct |
563 ms |
125996 KB |
Output is correct |
77 |
Correct |
548 ms |
126132 KB |
Output is correct |
78 |
Correct |
577 ms |
126060 KB |
Output is correct |
79 |
Correct |
387 ms |
108280 KB |
Output is correct |
80 |
Correct |
406 ms |
126220 KB |
Output is correct |
81 |
Correct |
444 ms |
125980 KB |
Output is correct |
82 |
Correct |
274 ms |
84248 KB |
Output is correct |
83 |
Correct |
245 ms |
88552 KB |
Output is correct |
84 |
Correct |
59 ms |
54400 KB |
Output is correct |
85 |
Correct |
65 ms |
55044 KB |
Output is correct |
86 |
Correct |
298 ms |
89612 KB |
Output is correct |
87 |
Correct |
296 ms |
89700 KB |
Output is correct |
88 |
Correct |
304 ms |
89836 KB |
Output is correct |
89 |
Correct |
301 ms |
89524 KB |
Output is correct |
90 |
Correct |
297 ms |
89620 KB |
Output is correct |
91 |
Correct |
304 ms |
89788 KB |
Output is correct |
92 |
Correct |
139 ms |
90392 KB |
Output is correct |
93 |
Correct |
179 ms |
88000 KB |
Output is correct |
94 |
Correct |
220 ms |
78952 KB |
Output is correct |
95 |
Correct |
268 ms |
87620 KB |
Output is correct |
96 |
Correct |
318 ms |
90556 KB |
Output is correct |
97 |
Correct |
342 ms |
90240 KB |
Output is correct |
98 |
Correct |
161 ms |
77052 KB |
Output is correct |
99 |
Correct |
205 ms |
81292 KB |
Output is correct |
100 |
Correct |
367 ms |
91076 KB |
Output is correct |
101 |
Correct |
396 ms |
89768 KB |
Output is correct |
102 |
Correct |
421 ms |
93824 KB |
Output is correct |
103 |
Correct |
287 ms |
87668 KB |
Output is correct |
104 |
Correct |
365 ms |
91516 KB |
Output is correct |
105 |
Correct |
427 ms |
94708 KB |
Output is correct |
106 |
Correct |
85 ms |
54616 KB |
Output is correct |
107 |
Correct |
84 ms |
55248 KB |
Output is correct |
108 |
Correct |
188 ms |
97104 KB |
Output is correct |
109 |
Correct |
157 ms |
88040 KB |
Output is correct |
110 |
Correct |
211 ms |
94252 KB |
Output is correct |
111 |
Correct |
218 ms |
94164 KB |
Output is correct |
112 |
Correct |
276 ms |
81556 KB |
Output is correct |
113 |
Correct |
340 ms |
87616 KB |
Output is correct |
114 |
Correct |
283 ms |
90932 KB |
Output is correct |
115 |
Correct |
334 ms |
94708 KB |
Output is correct |
116 |
Correct |
208 ms |
79968 KB |
Output is correct |
117 |
Correct |
306 ms |
89740 KB |
Output is correct |
118 |
Correct |
239 ms |
79712 KB |
Output is correct |
119 |
Correct |
226 ms |
79104 KB |
Output is correct |
120 |
Correct |
303 ms |
89636 KB |
Output is correct |
121 |
Correct |
307 ms |
89804 KB |
Output is correct |
122 |
Correct |
284 ms |
87372 KB |
Output is correct |
123 |
Correct |
307 ms |
89776 KB |
Output is correct |
124 |
Correct |
332 ms |
89752 KB |
Output is correct |
125 |
Correct |
279 ms |
81064 KB |
Output is correct |
126 |
Correct |
165 ms |
90488 KB |
Output is correct |
127 |
Correct |
160 ms |
82892 KB |
Output is correct |
128 |
Correct |
184 ms |
87976 KB |
Output is correct |
129 |
Correct |
234 ms |
83924 KB |
Output is correct |
130 |
Execution timed out |
1082 ms |
171140 KB |
Time limit exceeded |
131 |
Halted |
0 ms |
0 KB |
- |