// Om Namah Shivaya
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x, y) ((x + y - 1) / (y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep1(i, n) for(int i = 1; i <= n; ++i)
#define rev(i, s, e) for(int i = s; i >= e; --i)
#define trav(i, a) for(auto &i : a)
template<typename T>
void amin(T &a, T b) {
a = min(a, b);
}
template<typename T>
void amax(T &a, T b) {
a = max(a, b);
}
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x) 42
#endif
/*
refs:
https://codeforces.com/blog/entry/88748?#comment-772940
https://oj.uz/submission/741888
key idea:
sweep over shops instead of queries
when we are at a given shop, we can maintain all active queries in a segtree
op 1 = +k, op2 = -k
process all queries on this shop
let the query have ind = id
the #of people at the shop during the time of the query
= max suff sum ending at id
can be calculated with segtree
tot_guys = tot #of guys who have entered shop i until time = id (including people who have left)
curr_guys = current #of people in the shop
we want to find the group num of the vth guy in the guys currently at the shop
we will find the query id where (tot_guys-curr_guys+v)th guy amongst all guys who have entered the shop (and left)
can be done with b.s + segtree
once the query id is found, the group num can also be found
group num of this guy = group num of this query id
*/
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;
template<typename T>
struct segtree {
// https://codeforces.com/blog/entry/18051
/*=======================================================*/
struct data {
ll mxsuff, sum, plus_sum;
};
data neutral = {0, 0, 0};
data merge(data &left, data &right) {
data curr;
curr.mxsuff = max(right.mxsuff, right.sum + left.mxsuff);
curr.sum = left.sum + right.sum;
curr.plus_sum = left.plus_sum + right.plus_sum;
return curr;
}
void create(int i, T v) {
}
void modify(int i, T v) {
tr[i].sum = v;
tr[i].mxsuff = max(v, 0ll);
tr[i].plus_sum = max(v, 0ll);
}
/*=======================================================*/
int n;
vector<data> tr;
segtree() {
}
segtree(int siz) {
init(siz);
}
void init(int siz) {
n = siz;
tr.assign(2 * n, neutral);
}
void build(vector<T> &a, int siz) {
rep(i, siz) create(i + n, a[i]);
rev(i, n - 1, 1) tr[i] = merge(tr[i << 1], tr[i << 1 | 1]);
}
void pupd(int i, T v) {
modify(i + n, v);
for (i = (i + n) >> 1; i; i >>= 1) tr[i] = merge(tr[i << 1], tr[i << 1 | 1]);
}
data query(int l, int r) {
data resl = neutral, resr = neutral;
for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
if (l & 1) resl = merge(resl, tr[l++]);
if (!(r & 1)) resr = merge(tr[r--], resr);
}
return merge(resl, resr);
}
};
void solve(int test_case)
{
ll n, m, q; cin >> n >> m >> q;
vector<ll> group(q + 5);
vector<pll> upds[n + 5], queries[n + 5];
rep1(i, q) {
ll t; cin >> t;
if (t == 1) {
ll l, r, c, k; cin >> l >> r >> c >> k;
group[i] = c;
upds[l].pb({i, k});
upds[r + 1].pb({i, 0});
}
else if (t == 2) {
ll l, r, k; cin >> l >> r >> k;
upds[l].pb({i, -k});
upds[r + 1].pb({i, 0});
}
else {
ll x, y; cin >> x >> y;
queries[x].pb({y, i});
}
}
vector<ll> ans(q + 5, -1);
segtree<ll> st(q + 5);
rep1(i, n) {
for (auto [ind, val] : upds[i]) {
st.pupd(ind, val);
}
for (auto [v, id] : queries[i]) {
auto [mxsuff, sum, plus_sum] = st.query(1, id);
ll curr_guys = mxsuff;
ll tot_guys = plus_sum;
if (v > curr_guys) {
ans[id] = 0;
}
else {
ll want = tot_guys - curr_guys + v;
ll l = 1, r = id;
ll first = -1;
while (l <= r) {
ll mid = (l + r) >> 1;
if (st.query(1, mid).plus_sum >= want) {
first = mid;
r = mid - 1;
}
else {
l = mid + 1;
}
}
assert(first != -1);
ans[id] = group[first];
}
}
}
rep1(i, q) {
if (ans[i] != -1) {
cout << ans[i] << endl;
}
}
}
int main()
{
fastio;
int t = 1;
// cin >> t;
rep1(i, t) {
solve(i);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
2 ms |
596 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
576 KB |
Output is correct |
18 |
Correct |
2 ms |
596 KB |
Output is correct |
19 |
Correct |
2 ms |
596 KB |
Output is correct |
20 |
Correct |
2 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
2 ms |
596 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
576 KB |
Output is correct |
18 |
Correct |
2 ms |
596 KB |
Output is correct |
19 |
Correct |
2 ms |
596 KB |
Output is correct |
20 |
Correct |
2 ms |
596 KB |
Output is correct |
21 |
Correct |
2 ms |
596 KB |
Output is correct |
22 |
Correct |
2 ms |
596 KB |
Output is correct |
23 |
Correct |
2 ms |
596 KB |
Output is correct |
24 |
Correct |
3 ms |
596 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
2 ms |
468 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
3 ms |
596 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
3 ms |
596 KB |
Output is correct |
32 |
Correct |
2 ms |
588 KB |
Output is correct |
33 |
Correct |
2 ms |
596 KB |
Output is correct |
34 |
Correct |
2 ms |
592 KB |
Output is correct |
35 |
Correct |
2 ms |
596 KB |
Output is correct |
36 |
Correct |
2 ms |
588 KB |
Output is correct |
37 |
Correct |
1 ms |
468 KB |
Output is correct |
38 |
Correct |
2 ms |
584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
10572 KB |
Output is correct |
2 |
Correct |
54 ms |
10612 KB |
Output is correct |
3 |
Correct |
62 ms |
10568 KB |
Output is correct |
4 |
Correct |
60 ms |
10564 KB |
Output is correct |
5 |
Correct |
48 ms |
10592 KB |
Output is correct |
6 |
Correct |
56 ms |
10608 KB |
Output is correct |
7 |
Correct |
27 ms |
5948 KB |
Output is correct |
8 |
Correct |
31 ms |
6892 KB |
Output is correct |
9 |
Correct |
57 ms |
11680 KB |
Output is correct |
10 |
Correct |
48 ms |
11576 KB |
Output is correct |
11 |
Correct |
48 ms |
11660 KB |
Output is correct |
12 |
Correct |
50 ms |
11740 KB |
Output is correct |
13 |
Correct |
45 ms |
9536 KB |
Output is correct |
14 |
Correct |
57 ms |
11460 KB |
Output is correct |
15 |
Correct |
52 ms |
10712 KB |
Output is correct |
16 |
Correct |
59 ms |
11792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
35772 KB |
Output is correct |
2 |
Correct |
262 ms |
30540 KB |
Output is correct |
3 |
Correct |
381 ms |
40320 KB |
Output is correct |
4 |
Correct |
273 ms |
33080 KB |
Output is correct |
5 |
Correct |
254 ms |
30556 KB |
Output is correct |
6 |
Correct |
401 ms |
40632 KB |
Output is correct |
7 |
Correct |
193 ms |
24112 KB |
Output is correct |
8 |
Correct |
190 ms |
25300 KB |
Output is correct |
9 |
Correct |
418 ms |
39608 KB |
Output is correct |
10 |
Correct |
425 ms |
39492 KB |
Output is correct |
11 |
Correct |
370 ms |
40532 KB |
Output is correct |
12 |
Correct |
380 ms |
40540 KB |
Output is correct |
13 |
Correct |
365 ms |
40652 KB |
Output is correct |
14 |
Correct |
393 ms |
40552 KB |
Output is correct |
15 |
Correct |
372 ms |
40580 KB |
Output is correct |
16 |
Correct |
354 ms |
40544 KB |
Output is correct |
17 |
Correct |
377 ms |
40592 KB |
Output is correct |
18 |
Correct |
369 ms |
40540 KB |
Output is correct |
19 |
Correct |
348 ms |
40572 KB |
Output is correct |
20 |
Correct |
384 ms |
40576 KB |
Output is correct |
21 |
Correct |
374 ms |
40532 KB |
Output is correct |
22 |
Correct |
384 ms |
40628 KB |
Output is correct |
23 |
Correct |
377 ms |
40604 KB |
Output is correct |
24 |
Correct |
382 ms |
40648 KB |
Output is correct |
25 |
Correct |
285 ms |
37584 KB |
Output is correct |
26 |
Correct |
308 ms |
40740 KB |
Output is correct |
27 |
Correct |
279 ms |
41400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
2 ms |
596 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
576 KB |
Output is correct |
18 |
Correct |
2 ms |
596 KB |
Output is correct |
19 |
Correct |
2 ms |
596 KB |
Output is correct |
20 |
Correct |
2 ms |
596 KB |
Output is correct |
21 |
Correct |
53 ms |
10572 KB |
Output is correct |
22 |
Correct |
54 ms |
10612 KB |
Output is correct |
23 |
Correct |
62 ms |
10568 KB |
Output is correct |
24 |
Correct |
60 ms |
10564 KB |
Output is correct |
25 |
Correct |
48 ms |
10592 KB |
Output is correct |
26 |
Correct |
56 ms |
10608 KB |
Output is correct |
27 |
Correct |
27 ms |
5948 KB |
Output is correct |
28 |
Correct |
31 ms |
6892 KB |
Output is correct |
29 |
Correct |
57 ms |
11680 KB |
Output is correct |
30 |
Correct |
48 ms |
11576 KB |
Output is correct |
31 |
Correct |
48 ms |
11660 KB |
Output is correct |
32 |
Correct |
50 ms |
11740 KB |
Output is correct |
33 |
Correct |
45 ms |
9536 KB |
Output is correct |
34 |
Correct |
57 ms |
11460 KB |
Output is correct |
35 |
Correct |
52 ms |
10712 KB |
Output is correct |
36 |
Correct |
59 ms |
11792 KB |
Output is correct |
37 |
Correct |
53 ms |
10228 KB |
Output is correct |
38 |
Correct |
52 ms |
9588 KB |
Output is correct |
39 |
Correct |
30 ms |
5952 KB |
Output is correct |
40 |
Correct |
35 ms |
6472 KB |
Output is correct |
41 |
Correct |
67 ms |
11504 KB |
Output is correct |
42 |
Correct |
57 ms |
11496 KB |
Output is correct |
43 |
Correct |
60 ms |
11588 KB |
Output is correct |
44 |
Correct |
72 ms |
11488 KB |
Output is correct |
45 |
Correct |
73 ms |
11488 KB |
Output is correct |
46 |
Correct |
68 ms |
11472 KB |
Output is correct |
47 |
Correct |
46 ms |
10324 KB |
Output is correct |
48 |
Correct |
62 ms |
11408 KB |
Output is correct |
49 |
Correct |
47 ms |
8196 KB |
Output is correct |
50 |
Correct |
59 ms |
10256 KB |
Output is correct |
51 |
Correct |
65 ms |
11556 KB |
Output is correct |
52 |
Correct |
58 ms |
11548 KB |
Output is correct |
53 |
Correct |
40 ms |
9548 KB |
Output is correct |
54 |
Correct |
55 ms |
11752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
9448 KB |
Output is correct |
2 |
Correct |
86 ms |
9676 KB |
Output is correct |
3 |
Correct |
82 ms |
10344 KB |
Output is correct |
4 |
Correct |
59 ms |
8144 KB |
Output is correct |
5 |
Correct |
74 ms |
9268 KB |
Output is correct |
6 |
Correct |
73 ms |
10332 KB |
Output is correct |
7 |
Correct |
44 ms |
5688 KB |
Output is correct |
8 |
Correct |
43 ms |
5276 KB |
Output is correct |
9 |
Correct |
68 ms |
9652 KB |
Output is correct |
10 |
Correct |
45 ms |
7868 KB |
Output is correct |
11 |
Correct |
66 ms |
10004 KB |
Output is correct |
12 |
Correct |
66 ms |
9932 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
2 ms |
596 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
576 KB |
Output is correct |
18 |
Correct |
2 ms |
596 KB |
Output is correct |
19 |
Correct |
2 ms |
596 KB |
Output is correct |
20 |
Correct |
2 ms |
596 KB |
Output is correct |
21 |
Correct |
2 ms |
596 KB |
Output is correct |
22 |
Correct |
2 ms |
596 KB |
Output is correct |
23 |
Correct |
2 ms |
596 KB |
Output is correct |
24 |
Correct |
3 ms |
596 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
2 ms |
468 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
3 ms |
596 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
3 ms |
596 KB |
Output is correct |
32 |
Correct |
2 ms |
588 KB |
Output is correct |
33 |
Correct |
2 ms |
596 KB |
Output is correct |
34 |
Correct |
2 ms |
592 KB |
Output is correct |
35 |
Correct |
2 ms |
596 KB |
Output is correct |
36 |
Correct |
2 ms |
588 KB |
Output is correct |
37 |
Correct |
1 ms |
468 KB |
Output is correct |
38 |
Correct |
2 ms |
584 KB |
Output is correct |
39 |
Correct |
53 ms |
10572 KB |
Output is correct |
40 |
Correct |
54 ms |
10612 KB |
Output is correct |
41 |
Correct |
62 ms |
10568 KB |
Output is correct |
42 |
Correct |
60 ms |
10564 KB |
Output is correct |
43 |
Correct |
48 ms |
10592 KB |
Output is correct |
44 |
Correct |
56 ms |
10608 KB |
Output is correct |
45 |
Correct |
27 ms |
5948 KB |
Output is correct |
46 |
Correct |
31 ms |
6892 KB |
Output is correct |
47 |
Correct |
57 ms |
11680 KB |
Output is correct |
48 |
Correct |
48 ms |
11576 KB |
Output is correct |
49 |
Correct |
48 ms |
11660 KB |
Output is correct |
50 |
Correct |
50 ms |
11740 KB |
Output is correct |
51 |
Correct |
45 ms |
9536 KB |
Output is correct |
52 |
Correct |
57 ms |
11460 KB |
Output is correct |
53 |
Correct |
52 ms |
10712 KB |
Output is correct |
54 |
Correct |
59 ms |
11792 KB |
Output is correct |
55 |
Correct |
53 ms |
10228 KB |
Output is correct |
56 |
Correct |
52 ms |
9588 KB |
Output is correct |
57 |
Correct |
30 ms |
5952 KB |
Output is correct |
58 |
Correct |
35 ms |
6472 KB |
Output is correct |
59 |
Correct |
67 ms |
11504 KB |
Output is correct |
60 |
Correct |
57 ms |
11496 KB |
Output is correct |
61 |
Correct |
60 ms |
11588 KB |
Output is correct |
62 |
Correct |
72 ms |
11488 KB |
Output is correct |
63 |
Correct |
73 ms |
11488 KB |
Output is correct |
64 |
Correct |
68 ms |
11472 KB |
Output is correct |
65 |
Correct |
46 ms |
10324 KB |
Output is correct |
66 |
Correct |
62 ms |
11408 KB |
Output is correct |
67 |
Correct |
47 ms |
8196 KB |
Output is correct |
68 |
Correct |
59 ms |
10256 KB |
Output is correct |
69 |
Correct |
65 ms |
11556 KB |
Output is correct |
70 |
Correct |
58 ms |
11548 KB |
Output is correct |
71 |
Correct |
40 ms |
9548 KB |
Output is correct |
72 |
Correct |
55 ms |
11752 KB |
Output is correct |
73 |
Correct |
73 ms |
9448 KB |
Output is correct |
74 |
Correct |
86 ms |
9676 KB |
Output is correct |
75 |
Correct |
82 ms |
10344 KB |
Output is correct |
76 |
Correct |
59 ms |
8144 KB |
Output is correct |
77 |
Correct |
74 ms |
9268 KB |
Output is correct |
78 |
Correct |
73 ms |
10332 KB |
Output is correct |
79 |
Correct |
44 ms |
5688 KB |
Output is correct |
80 |
Correct |
43 ms |
5276 KB |
Output is correct |
81 |
Correct |
68 ms |
9652 KB |
Output is correct |
82 |
Correct |
45 ms |
7868 KB |
Output is correct |
83 |
Correct |
66 ms |
10004 KB |
Output is correct |
84 |
Correct |
66 ms |
9932 KB |
Output is correct |
85 |
Correct |
68 ms |
10324 KB |
Output is correct |
86 |
Correct |
92 ms |
11596 KB |
Output is correct |
87 |
Correct |
61 ms |
10656 KB |
Output is correct |
88 |
Correct |
71 ms |
11684 KB |
Output is correct |
89 |
Correct |
44 ms |
8568 KB |
Output is correct |
90 |
Correct |
71 ms |
11732 KB |
Output is correct |
91 |
Correct |
52 ms |
9412 KB |
Output is correct |
92 |
Correct |
48 ms |
9156 KB |
Output is correct |
93 |
Correct |
64 ms |
11740 KB |
Output is correct |
94 |
Correct |
79 ms |
11684 KB |
Output is correct |
95 |
Correct |
77 ms |
11232 KB |
Output is correct |
96 |
Correct |
69 ms |
11680 KB |
Output is correct |
97 |
Correct |
67 ms |
11680 KB |
Output is correct |
98 |
Correct |
54 ms |
9748 KB |
Output is correct |
99 |
Correct |
51 ms |
10700 KB |
Output is correct |
100 |
Correct |
59 ms |
9812 KB |
Output is correct |
101 |
Correct |
69 ms |
11812 KB |
Output is correct |
102 |
Correct |
56 ms |
11904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
2 ms |
596 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
576 KB |
Output is correct |
18 |
Correct |
2 ms |
596 KB |
Output is correct |
19 |
Correct |
2 ms |
596 KB |
Output is correct |
20 |
Correct |
2 ms |
596 KB |
Output is correct |
21 |
Correct |
2 ms |
596 KB |
Output is correct |
22 |
Correct |
2 ms |
596 KB |
Output is correct |
23 |
Correct |
2 ms |
596 KB |
Output is correct |
24 |
Correct |
3 ms |
596 KB |
Output is correct |
25 |
Correct |
2 ms |
468 KB |
Output is correct |
26 |
Correct |
2 ms |
468 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
3 ms |
596 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
3 ms |
596 KB |
Output is correct |
32 |
Correct |
2 ms |
588 KB |
Output is correct |
33 |
Correct |
2 ms |
596 KB |
Output is correct |
34 |
Correct |
2 ms |
592 KB |
Output is correct |
35 |
Correct |
2 ms |
596 KB |
Output is correct |
36 |
Correct |
2 ms |
588 KB |
Output is correct |
37 |
Correct |
1 ms |
468 KB |
Output is correct |
38 |
Correct |
2 ms |
584 KB |
Output is correct |
39 |
Correct |
53 ms |
10572 KB |
Output is correct |
40 |
Correct |
54 ms |
10612 KB |
Output is correct |
41 |
Correct |
62 ms |
10568 KB |
Output is correct |
42 |
Correct |
60 ms |
10564 KB |
Output is correct |
43 |
Correct |
48 ms |
10592 KB |
Output is correct |
44 |
Correct |
56 ms |
10608 KB |
Output is correct |
45 |
Correct |
27 ms |
5948 KB |
Output is correct |
46 |
Correct |
31 ms |
6892 KB |
Output is correct |
47 |
Correct |
57 ms |
11680 KB |
Output is correct |
48 |
Correct |
48 ms |
11576 KB |
Output is correct |
49 |
Correct |
48 ms |
11660 KB |
Output is correct |
50 |
Correct |
50 ms |
11740 KB |
Output is correct |
51 |
Correct |
45 ms |
9536 KB |
Output is correct |
52 |
Correct |
57 ms |
11460 KB |
Output is correct |
53 |
Correct |
52 ms |
10712 KB |
Output is correct |
54 |
Correct |
59 ms |
11792 KB |
Output is correct |
55 |
Correct |
366 ms |
35772 KB |
Output is correct |
56 |
Correct |
262 ms |
30540 KB |
Output is correct |
57 |
Correct |
381 ms |
40320 KB |
Output is correct |
58 |
Correct |
273 ms |
33080 KB |
Output is correct |
59 |
Correct |
254 ms |
30556 KB |
Output is correct |
60 |
Correct |
401 ms |
40632 KB |
Output is correct |
61 |
Correct |
193 ms |
24112 KB |
Output is correct |
62 |
Correct |
190 ms |
25300 KB |
Output is correct |
63 |
Correct |
418 ms |
39608 KB |
Output is correct |
64 |
Correct |
425 ms |
39492 KB |
Output is correct |
65 |
Correct |
370 ms |
40532 KB |
Output is correct |
66 |
Correct |
380 ms |
40540 KB |
Output is correct |
67 |
Correct |
365 ms |
40652 KB |
Output is correct |
68 |
Correct |
393 ms |
40552 KB |
Output is correct |
69 |
Correct |
372 ms |
40580 KB |
Output is correct |
70 |
Correct |
354 ms |
40544 KB |
Output is correct |
71 |
Correct |
377 ms |
40592 KB |
Output is correct |
72 |
Correct |
369 ms |
40540 KB |
Output is correct |
73 |
Correct |
348 ms |
40572 KB |
Output is correct |
74 |
Correct |
384 ms |
40576 KB |
Output is correct |
75 |
Correct |
374 ms |
40532 KB |
Output is correct |
76 |
Correct |
384 ms |
40628 KB |
Output is correct |
77 |
Correct |
377 ms |
40604 KB |
Output is correct |
78 |
Correct |
382 ms |
40648 KB |
Output is correct |
79 |
Correct |
285 ms |
37584 KB |
Output is correct |
80 |
Correct |
308 ms |
40740 KB |
Output is correct |
81 |
Correct |
279 ms |
41400 KB |
Output is correct |
82 |
Correct |
53 ms |
10228 KB |
Output is correct |
83 |
Correct |
52 ms |
9588 KB |
Output is correct |
84 |
Correct |
30 ms |
5952 KB |
Output is correct |
85 |
Correct |
35 ms |
6472 KB |
Output is correct |
86 |
Correct |
67 ms |
11504 KB |
Output is correct |
87 |
Correct |
57 ms |
11496 KB |
Output is correct |
88 |
Correct |
60 ms |
11588 KB |
Output is correct |
89 |
Correct |
72 ms |
11488 KB |
Output is correct |
90 |
Correct |
73 ms |
11488 KB |
Output is correct |
91 |
Correct |
68 ms |
11472 KB |
Output is correct |
92 |
Correct |
46 ms |
10324 KB |
Output is correct |
93 |
Correct |
62 ms |
11408 KB |
Output is correct |
94 |
Correct |
47 ms |
8196 KB |
Output is correct |
95 |
Correct |
59 ms |
10256 KB |
Output is correct |
96 |
Correct |
65 ms |
11556 KB |
Output is correct |
97 |
Correct |
58 ms |
11548 KB |
Output is correct |
98 |
Correct |
40 ms |
9548 KB |
Output is correct |
99 |
Correct |
55 ms |
11752 KB |
Output is correct |
100 |
Correct |
73 ms |
9448 KB |
Output is correct |
101 |
Correct |
86 ms |
9676 KB |
Output is correct |
102 |
Correct |
82 ms |
10344 KB |
Output is correct |
103 |
Correct |
59 ms |
8144 KB |
Output is correct |
104 |
Correct |
74 ms |
9268 KB |
Output is correct |
105 |
Correct |
73 ms |
10332 KB |
Output is correct |
106 |
Correct |
44 ms |
5688 KB |
Output is correct |
107 |
Correct |
43 ms |
5276 KB |
Output is correct |
108 |
Correct |
68 ms |
9652 KB |
Output is correct |
109 |
Correct |
45 ms |
7868 KB |
Output is correct |
110 |
Correct |
66 ms |
10004 KB |
Output is correct |
111 |
Correct |
66 ms |
9932 KB |
Output is correct |
112 |
Correct |
68 ms |
10324 KB |
Output is correct |
113 |
Correct |
92 ms |
11596 KB |
Output is correct |
114 |
Correct |
61 ms |
10656 KB |
Output is correct |
115 |
Correct |
71 ms |
11684 KB |
Output is correct |
116 |
Correct |
44 ms |
8568 KB |
Output is correct |
117 |
Correct |
71 ms |
11732 KB |
Output is correct |
118 |
Correct |
52 ms |
9412 KB |
Output is correct |
119 |
Correct |
48 ms |
9156 KB |
Output is correct |
120 |
Correct |
64 ms |
11740 KB |
Output is correct |
121 |
Correct |
79 ms |
11684 KB |
Output is correct |
122 |
Correct |
77 ms |
11232 KB |
Output is correct |
123 |
Correct |
69 ms |
11680 KB |
Output is correct |
124 |
Correct |
67 ms |
11680 KB |
Output is correct |
125 |
Correct |
54 ms |
9748 KB |
Output is correct |
126 |
Correct |
51 ms |
10700 KB |
Output is correct |
127 |
Correct |
59 ms |
9812 KB |
Output is correct |
128 |
Correct |
69 ms |
11812 KB |
Output is correct |
129 |
Correct |
56 ms |
11904 KB |
Output is correct |
130 |
Correct |
410 ms |
39976 KB |
Output is correct |
131 |
Correct |
270 ms |
30040 KB |
Output is correct |
132 |
Correct |
423 ms |
40312 KB |
Output is correct |
133 |
Correct |
347 ms |
38844 KB |
Output is correct |
134 |
Correct |
375 ms |
36144 KB |
Output is correct |
135 |
Correct |
420 ms |
40552 KB |
Output is correct |
136 |
Correct |
439 ms |
39628 KB |
Output is correct |
137 |
Correct |
450 ms |
39604 KB |
Output is correct |
138 |
Correct |
374 ms |
40588 KB |
Output is correct |
139 |
Correct |
396 ms |
40500 KB |
Output is correct |
140 |
Correct |
364 ms |
40548 KB |
Output is correct |
141 |
Correct |
345 ms |
40568 KB |
Output is correct |
142 |
Correct |
383 ms |
40408 KB |
Output is correct |
143 |
Correct |
372 ms |
40524 KB |
Output is correct |
144 |
Correct |
361 ms |
40408 KB |
Output is correct |
145 |
Correct |
345 ms |
40380 KB |
Output is correct |
146 |
Correct |
360 ms |
40504 KB |
Output is correct |
147 |
Correct |
376 ms |
40396 KB |
Output is correct |
148 |
Correct |
354 ms |
40412 KB |
Output is correct |
149 |
Correct |
354 ms |
40460 KB |
Output is correct |
150 |
Correct |
276 ms |
36724 KB |
Output is correct |
151 |
Correct |
318 ms |
40728 KB |
Output is correct |
152 |
Correct |
315 ms |
40652 KB |
Output is correct |
153 |
Correct |
272 ms |
41140 KB |
Output is correct |