#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define F first
#define S second
using namespace std;
const ll inf = 1'000'000'000'000'000'000;
const ll mxN = 2'000'006;
int N, M;
ll A[mxN], B[mxN], S[mxN], T[mxN], P[mxN], Q[mxN], dp[mxN], seg[4 * mxN], lazy[4 * mxN], bit[mxN], rcost[mxN], ucost[mxN], tmp[mxN][2];
int rangeA[mxN], rangeB[mxN], nrange[mxN];
bool vis[mxN];
vector<pii> ins[mxN];
void Bmodify(int pos, ll val)
{
for (int i = pos; i < mxN; i += (i & -i))
bit[i] += val;
}
ll Bquery(int pos)
{
ll ans = 0;
for (int i = pos; i > 0; i -= (i & -i))
ans += bit[i];
return ans;
}
void init(int i = 1, int L = 0, int R = N)
{
if (L == R)
seg[i] = -inf, lazy[i] = 0;
if (L != R)
{
int mid = (L + R) / 2;
init(i << 1, L, mid);
init(i << 1 | 1, mid + 1, R);
}
}
void modify(int mL, int mR, ll val, int i = 1, int L = 0, int R = N)
{
if (mL <= L && R <= mR)
seg[i] += val, lazy[i] += val;
else if (R < mL || mR < L)
return;
else
{
int mid = (L + R) / 2;
seg[i << 1] += lazy[i], seg[i << 1 | 1] += lazy[i];
lazy[i << 1] += lazy[i], lazy[i << 1 | 1] += lazy[i];
lazy[i] = 0;
modify(mL, mR, val, i << 1, L, mid);
modify(mL, mR, val, i << 1 | 1, mid + 1, R);
seg[i] = max(seg[i << 1], seg[i << 1 | 1]);
}
}
ll query(int mL, int mR, int i = 1, int L = 0, int R = N)
{
if (mL <= L && R <= mR)
return seg[i];
else if (R < mL || mR < L)
return -inf;
else
{
int mid = (L + R) / 2;
seg[i << 1] += lazy[i], seg[i << 1 | 1] += lazy[i];
lazy[i << 1] += lazy[i], lazy[i << 1 | 1] += lazy[i];
lazy[i] = 0;
return max(query(mL, mR, i << 1, L, mid),
query(mL, mR, i << 1 | 1, mid + 1, R));
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> N >> M;
for (int i = 1; i <= N; i++)
{
cin >> A[i] >> S[i] >> P[i];
A[i] += A[i - 1];
}
for (int i = 1; i <= M; i++)
{
cin >> B[i] >> T[i] >> Q[i];
B[i] += B[i - 1];
}
for (int i = 1; i <= N; i++)
{
rangeA[i] = upper_bound(B, B + 1 + M, S[i] - A[i]) - B - 1;
if (rangeA[i] == -1)
rangeA[i] = 0, P[i] = 0;
}
for (int i = 1; i <= M; i++)
{
rangeB[i] = upper_bound(A, A + 1 + N, T[i] - B[i]) - A - 1;
if (rangeB[i] == -1)
rangeB[i] = 0, Q[i] = 0;
if (rangeB[i] < N)
{ // cerr << "build insert " << i << " -> " << rangeB[i] + 1 << '\n';
ins[rangeB[i] + 1].emplace_back(pii(i - 1, i));
if (rangeA[rangeB[i] + 1] == i - 1)
vis[rangeB[i] + 1] = 1;
}
else
rangeB[i] = -1;
}
rangeA[++N] = M;
for (int i = 1; i <= N; i++)
if (!vis[i])
ins[i].emplace_back(pii(rangeA[i], -1));
for (int i = 1; i <= N; i++)
tmp[i][0] = P[i], tmp[i][1] = rangeA[i];
int nN = 0;
for (int i = 1; i <= N; i++)
{
sort(ins[i].begin(), ins[i].end(), greater<>());
for (auto [j, k] : ins[i])
{
++nN;
rangeA[nN] = j;
P[nN] = 0;
if (j == tmp[i][1])
{
P[nN] = tmp[i][0];
rangeA[nN] = tmp[i][1];
nrange[i] = nN;
}
if (k > 0)
rangeB[k] = nN - 1;
}
}
N = nN;
for (int i = 1; i <= M; i++)
if(rangeB[i] == -1)
rangeB[i] = N;
vector<int> v;
for (int i = 1; i <= N; i++)
v.emplace_back(i);
sort(v.begin(), v.end(), [&](int i, int j)
{ return make_pair(rangeA[i], -i) < make_pair(rangeA[j], -j); });
ll sumR = 0;
for (int i = N; i >= 1; i--)
{
rcost[i] = sumR - Bquery(rangeA[i] + 1);
sumR += P[i];
Bmodify(rangeA[i] + 1, P[i]);
}
for (int i = 0; i < mxN; i++)
bit[i] = 0;
int last = 1;
ll sumU = 0;
init();
modify(0, 0, inf);
for (int i = 1; i <= N; i++)
modify(0, i - 1, P[i]);
for (int i : v)
{
while (last <= rangeA[i] && last <= M)
{
sumU += Q[last];
Bmodify(rangeB[last] + 1, Q[last]);
modify(0, rangeB[last], Q[last]);
last++;
}
ucost[i] = sumU - Bquery(i);
dp[i] = query(0, i - 1) - rcost[i];
// cerr << i << ' ' << rangeA[i] << ' ' << query(0, i - 1) << " - " << rcost[i] << '\n';
modify(0, i - 1, -P[i]);
modify(i, i, inf + dp[i] - ucost[i]);
}
cout << dp[N] << '\n';
}
/*
1 2
1 0 0
1 0 0
1 5 -1
3 3
1 1 1
1 3 -5
1 4 -2
1 1 2
1 3 -1
1 4 -2
2 2
1 1 5
1 10 -10
1 0 0
1 3 6
2 2
*/
Compilation message
dishes.cpp: In function 'int main()':
dishes.cpp:126:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
126 | for (auto [j, k] : ins[i])
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
506 ms |
110000 KB |
Output is correct |
2 |
Correct |
459 ms |
99912 KB |
Output is correct |
3 |
Correct |
345 ms |
98376 KB |
Output is correct |
4 |
Correct |
452 ms |
109844 KB |
Output is correct |
5 |
Correct |
31 ms |
63060 KB |
Output is correct |
6 |
Correct |
402 ms |
99416 KB |
Output is correct |
7 |
Correct |
145 ms |
71208 KB |
Output is correct |
8 |
Correct |
275 ms |
92972 KB |
Output is correct |
9 |
Correct |
347 ms |
98296 KB |
Output is correct |
10 |
Correct |
356 ms |
98580 KB |
Output is correct |
11 |
Correct |
322 ms |
98408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
63060 KB |
Output is correct |
2 |
Correct |
32 ms |
62936 KB |
Output is correct |
3 |
Correct |
30 ms |
63000 KB |
Output is correct |
4 |
Correct |
30 ms |
62936 KB |
Output is correct |
5 |
Correct |
36 ms |
62948 KB |
Output is correct |
6 |
Correct |
33 ms |
63060 KB |
Output is correct |
7 |
Correct |
34 ms |
63012 KB |
Output is correct |
8 |
Correct |
31 ms |
63020 KB |
Output is correct |
9 |
Correct |
32 ms |
63052 KB |
Output is correct |
10 |
Correct |
33 ms |
63072 KB |
Output is correct |
11 |
Correct |
32 ms |
62952 KB |
Output is correct |
12 |
Correct |
31 ms |
63036 KB |
Output is correct |
13 |
Correct |
31 ms |
63060 KB |
Output is correct |
14 |
Correct |
35 ms |
63048 KB |
Output is correct |
15 |
Correct |
32 ms |
63048 KB |
Output is correct |
16 |
Correct |
31 ms |
62988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
63060 KB |
Output is correct |
2 |
Correct |
32 ms |
62936 KB |
Output is correct |
3 |
Correct |
30 ms |
63000 KB |
Output is correct |
4 |
Correct |
30 ms |
62936 KB |
Output is correct |
5 |
Correct |
36 ms |
62948 KB |
Output is correct |
6 |
Correct |
33 ms |
63060 KB |
Output is correct |
7 |
Correct |
34 ms |
63012 KB |
Output is correct |
8 |
Correct |
31 ms |
63020 KB |
Output is correct |
9 |
Correct |
32 ms |
63052 KB |
Output is correct |
10 |
Correct |
33 ms |
63072 KB |
Output is correct |
11 |
Correct |
32 ms |
62952 KB |
Output is correct |
12 |
Correct |
31 ms |
63036 KB |
Output is correct |
13 |
Correct |
31 ms |
63060 KB |
Output is correct |
14 |
Correct |
35 ms |
63048 KB |
Output is correct |
15 |
Correct |
32 ms |
63048 KB |
Output is correct |
16 |
Correct |
31 ms |
62988 KB |
Output is correct |
17 |
Correct |
34 ms |
63420 KB |
Output is correct |
18 |
Correct |
35 ms |
63660 KB |
Output is correct |
19 |
Correct |
35 ms |
63464 KB |
Output is correct |
20 |
Correct |
42 ms |
63480 KB |
Output is correct |
21 |
Correct |
35 ms |
63436 KB |
Output is correct |
22 |
Correct |
41 ms |
63496 KB |
Output is correct |
23 |
Correct |
36 ms |
63520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
63060 KB |
Output is correct |
2 |
Correct |
32 ms |
62936 KB |
Output is correct |
3 |
Correct |
30 ms |
63000 KB |
Output is correct |
4 |
Correct |
30 ms |
62936 KB |
Output is correct |
5 |
Correct |
36 ms |
62948 KB |
Output is correct |
6 |
Correct |
33 ms |
63060 KB |
Output is correct |
7 |
Correct |
34 ms |
63012 KB |
Output is correct |
8 |
Correct |
31 ms |
63020 KB |
Output is correct |
9 |
Correct |
32 ms |
63052 KB |
Output is correct |
10 |
Correct |
33 ms |
63072 KB |
Output is correct |
11 |
Correct |
32 ms |
62952 KB |
Output is correct |
12 |
Correct |
31 ms |
63036 KB |
Output is correct |
13 |
Correct |
31 ms |
63060 KB |
Output is correct |
14 |
Correct |
35 ms |
63048 KB |
Output is correct |
15 |
Correct |
32 ms |
63048 KB |
Output is correct |
16 |
Correct |
31 ms |
62988 KB |
Output is correct |
17 |
Correct |
34 ms |
63420 KB |
Output is correct |
18 |
Correct |
35 ms |
63660 KB |
Output is correct |
19 |
Correct |
35 ms |
63464 KB |
Output is correct |
20 |
Correct |
42 ms |
63480 KB |
Output is correct |
21 |
Correct |
35 ms |
63436 KB |
Output is correct |
22 |
Correct |
41 ms |
63496 KB |
Output is correct |
23 |
Correct |
36 ms |
63520 KB |
Output is correct |
24 |
Correct |
436 ms |
111304 KB |
Output is correct |
25 |
Correct |
525 ms |
116076 KB |
Output is correct |
26 |
Correct |
441 ms |
111324 KB |
Output is correct |
27 |
Correct |
528 ms |
114448 KB |
Output is correct |
28 |
Correct |
493 ms |
110052 KB |
Output is correct |
29 |
Correct |
335 ms |
98436 KB |
Output is correct |
30 |
Correct |
899 ms |
115296 KB |
Output is correct |
31 |
Correct |
188 ms |
78296 KB |
Output is correct |
32 |
Correct |
307 ms |
92924 KB |
Output is correct |
33 |
Correct |
723 ms |
115000 KB |
Output is correct |
34 |
Correct |
738 ms |
113800 KB |
Output is correct |
35 |
Correct |
837 ms |
115384 KB |
Output is correct |
36 |
Correct |
816 ms |
115312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
63060 KB |
Output is correct |
2 |
Correct |
32 ms |
62936 KB |
Output is correct |
3 |
Correct |
30 ms |
63000 KB |
Output is correct |
4 |
Correct |
30 ms |
62936 KB |
Output is correct |
5 |
Correct |
36 ms |
62948 KB |
Output is correct |
6 |
Correct |
33 ms |
63060 KB |
Output is correct |
7 |
Correct |
34 ms |
63012 KB |
Output is correct |
8 |
Correct |
31 ms |
63020 KB |
Output is correct |
9 |
Correct |
32 ms |
63052 KB |
Output is correct |
10 |
Correct |
33 ms |
63072 KB |
Output is correct |
11 |
Correct |
32 ms |
62952 KB |
Output is correct |
12 |
Correct |
31 ms |
63036 KB |
Output is correct |
13 |
Correct |
31 ms |
63060 KB |
Output is correct |
14 |
Correct |
35 ms |
63048 KB |
Output is correct |
15 |
Correct |
32 ms |
63048 KB |
Output is correct |
16 |
Correct |
31 ms |
62988 KB |
Output is correct |
17 |
Correct |
34 ms |
63420 KB |
Output is correct |
18 |
Correct |
35 ms |
63660 KB |
Output is correct |
19 |
Correct |
35 ms |
63464 KB |
Output is correct |
20 |
Correct |
42 ms |
63480 KB |
Output is correct |
21 |
Correct |
35 ms |
63436 KB |
Output is correct |
22 |
Correct |
41 ms |
63496 KB |
Output is correct |
23 |
Correct |
36 ms |
63520 KB |
Output is correct |
24 |
Correct |
436 ms |
111304 KB |
Output is correct |
25 |
Correct |
525 ms |
116076 KB |
Output is correct |
26 |
Correct |
441 ms |
111324 KB |
Output is correct |
27 |
Correct |
528 ms |
114448 KB |
Output is correct |
28 |
Correct |
493 ms |
110052 KB |
Output is correct |
29 |
Correct |
335 ms |
98436 KB |
Output is correct |
30 |
Correct |
899 ms |
115296 KB |
Output is correct |
31 |
Correct |
188 ms |
78296 KB |
Output is correct |
32 |
Correct |
307 ms |
92924 KB |
Output is correct |
33 |
Correct |
723 ms |
115000 KB |
Output is correct |
34 |
Correct |
738 ms |
113800 KB |
Output is correct |
35 |
Correct |
837 ms |
115384 KB |
Output is correct |
36 |
Correct |
816 ms |
115312 KB |
Output is correct |
37 |
Correct |
473 ms |
111340 KB |
Output is correct |
38 |
Correct |
644 ms |
115256 KB |
Output is correct |
39 |
Correct |
398 ms |
99540 KB |
Output is correct |
40 |
Correct |
377 ms |
99532 KB |
Output is correct |
41 |
Correct |
34 ms |
62976 KB |
Output is correct |
42 |
Correct |
867 ms |
116032 KB |
Output is correct |
43 |
Correct |
736 ms |
115540 KB |
Output is correct |
44 |
Correct |
766 ms |
114464 KB |
Output is correct |
45 |
Correct |
856 ms |
116240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
63060 KB |
Output is correct |
2 |
Correct |
32 ms |
62936 KB |
Output is correct |
3 |
Correct |
30 ms |
63000 KB |
Output is correct |
4 |
Correct |
30 ms |
62936 KB |
Output is correct |
5 |
Correct |
36 ms |
62948 KB |
Output is correct |
6 |
Correct |
33 ms |
63060 KB |
Output is correct |
7 |
Correct |
34 ms |
63012 KB |
Output is correct |
8 |
Correct |
31 ms |
63020 KB |
Output is correct |
9 |
Correct |
32 ms |
63052 KB |
Output is correct |
10 |
Correct |
33 ms |
63072 KB |
Output is correct |
11 |
Correct |
32 ms |
62952 KB |
Output is correct |
12 |
Correct |
31 ms |
63036 KB |
Output is correct |
13 |
Correct |
31 ms |
63060 KB |
Output is correct |
14 |
Correct |
35 ms |
63048 KB |
Output is correct |
15 |
Correct |
32 ms |
63048 KB |
Output is correct |
16 |
Correct |
31 ms |
62988 KB |
Output is correct |
17 |
Correct |
34 ms |
63420 KB |
Output is correct |
18 |
Correct |
35 ms |
63660 KB |
Output is correct |
19 |
Correct |
35 ms |
63464 KB |
Output is correct |
20 |
Correct |
42 ms |
63480 KB |
Output is correct |
21 |
Correct |
35 ms |
63436 KB |
Output is correct |
22 |
Correct |
41 ms |
63496 KB |
Output is correct |
23 |
Correct |
36 ms |
63520 KB |
Output is correct |
24 |
Correct |
436 ms |
111304 KB |
Output is correct |
25 |
Correct |
525 ms |
116076 KB |
Output is correct |
26 |
Correct |
441 ms |
111324 KB |
Output is correct |
27 |
Correct |
528 ms |
114448 KB |
Output is correct |
28 |
Correct |
493 ms |
110052 KB |
Output is correct |
29 |
Correct |
335 ms |
98436 KB |
Output is correct |
30 |
Correct |
899 ms |
115296 KB |
Output is correct |
31 |
Correct |
188 ms |
78296 KB |
Output is correct |
32 |
Correct |
307 ms |
92924 KB |
Output is correct |
33 |
Correct |
723 ms |
115000 KB |
Output is correct |
34 |
Correct |
738 ms |
113800 KB |
Output is correct |
35 |
Correct |
837 ms |
115384 KB |
Output is correct |
36 |
Correct |
816 ms |
115312 KB |
Output is correct |
37 |
Correct |
473 ms |
111340 KB |
Output is correct |
38 |
Correct |
644 ms |
115256 KB |
Output is correct |
39 |
Correct |
398 ms |
99540 KB |
Output is correct |
40 |
Correct |
377 ms |
99532 KB |
Output is correct |
41 |
Correct |
34 ms |
62976 KB |
Output is correct |
42 |
Correct |
867 ms |
116032 KB |
Output is correct |
43 |
Correct |
736 ms |
115540 KB |
Output is correct |
44 |
Correct |
766 ms |
114464 KB |
Output is correct |
45 |
Correct |
856 ms |
116240 KB |
Output is correct |
46 |
Correct |
2333 ms |
286200 KB |
Output is correct |
47 |
Correct |
2849 ms |
301496 KB |
Output is correct |
48 |
Correct |
1818 ms |
230604 KB |
Output is correct |
49 |
Correct |
1794 ms |
230496 KB |
Output is correct |
50 |
Correct |
5236 ms |
306004 KB |
Output is correct |
51 |
Correct |
3823 ms |
298368 KB |
Output is correct |
52 |
Correct |
3906 ms |
293156 KB |
Output is correct |
53 |
Correct |
4778 ms |
305916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
506 ms |
110000 KB |
Output is correct |
2 |
Correct |
459 ms |
99912 KB |
Output is correct |
3 |
Correct |
345 ms |
98376 KB |
Output is correct |
4 |
Correct |
452 ms |
109844 KB |
Output is correct |
5 |
Correct |
31 ms |
63060 KB |
Output is correct |
6 |
Correct |
402 ms |
99416 KB |
Output is correct |
7 |
Correct |
145 ms |
71208 KB |
Output is correct |
8 |
Correct |
275 ms |
92972 KB |
Output is correct |
9 |
Correct |
347 ms |
98296 KB |
Output is correct |
10 |
Correct |
356 ms |
98580 KB |
Output is correct |
11 |
Correct |
322 ms |
98408 KB |
Output is correct |
12 |
Correct |
30 ms |
63060 KB |
Output is correct |
13 |
Correct |
32 ms |
62936 KB |
Output is correct |
14 |
Correct |
30 ms |
63000 KB |
Output is correct |
15 |
Correct |
30 ms |
62936 KB |
Output is correct |
16 |
Correct |
36 ms |
62948 KB |
Output is correct |
17 |
Correct |
33 ms |
63060 KB |
Output is correct |
18 |
Correct |
34 ms |
63012 KB |
Output is correct |
19 |
Correct |
31 ms |
63020 KB |
Output is correct |
20 |
Correct |
32 ms |
63052 KB |
Output is correct |
21 |
Correct |
33 ms |
63072 KB |
Output is correct |
22 |
Correct |
32 ms |
62952 KB |
Output is correct |
23 |
Correct |
31 ms |
63036 KB |
Output is correct |
24 |
Correct |
31 ms |
63060 KB |
Output is correct |
25 |
Correct |
35 ms |
63048 KB |
Output is correct |
26 |
Correct |
32 ms |
63048 KB |
Output is correct |
27 |
Correct |
31 ms |
62988 KB |
Output is correct |
28 |
Correct |
34 ms |
63420 KB |
Output is correct |
29 |
Correct |
35 ms |
63660 KB |
Output is correct |
30 |
Correct |
35 ms |
63464 KB |
Output is correct |
31 |
Correct |
42 ms |
63480 KB |
Output is correct |
32 |
Correct |
35 ms |
63436 KB |
Output is correct |
33 |
Correct |
41 ms |
63496 KB |
Output is correct |
34 |
Correct |
36 ms |
63520 KB |
Output is correct |
35 |
Correct |
436 ms |
111304 KB |
Output is correct |
36 |
Correct |
525 ms |
116076 KB |
Output is correct |
37 |
Correct |
441 ms |
111324 KB |
Output is correct |
38 |
Correct |
528 ms |
114448 KB |
Output is correct |
39 |
Correct |
493 ms |
110052 KB |
Output is correct |
40 |
Correct |
335 ms |
98436 KB |
Output is correct |
41 |
Correct |
899 ms |
115296 KB |
Output is correct |
42 |
Correct |
188 ms |
78296 KB |
Output is correct |
43 |
Correct |
307 ms |
92924 KB |
Output is correct |
44 |
Correct |
723 ms |
115000 KB |
Output is correct |
45 |
Correct |
738 ms |
113800 KB |
Output is correct |
46 |
Correct |
837 ms |
115384 KB |
Output is correct |
47 |
Correct |
816 ms |
115312 KB |
Output is correct |
48 |
Correct |
473 ms |
111340 KB |
Output is correct |
49 |
Correct |
644 ms |
115256 KB |
Output is correct |
50 |
Correct |
398 ms |
99540 KB |
Output is correct |
51 |
Correct |
377 ms |
99532 KB |
Output is correct |
52 |
Correct |
34 ms |
62976 KB |
Output is correct |
53 |
Correct |
867 ms |
116032 KB |
Output is correct |
54 |
Correct |
736 ms |
115540 KB |
Output is correct |
55 |
Correct |
766 ms |
114464 KB |
Output is correct |
56 |
Correct |
856 ms |
116240 KB |
Output is correct |
57 |
Correct |
489 ms |
112128 KB |
Output is correct |
58 |
Correct |
561 ms |
114872 KB |
Output is correct |
59 |
Correct |
371 ms |
99076 KB |
Output is correct |
60 |
Correct |
366 ms |
99028 KB |
Output is correct |
61 |
Correct |
840 ms |
115900 KB |
Output is correct |
62 |
Correct |
31 ms |
63060 KB |
Output is correct |
63 |
Correct |
853 ms |
115780 KB |
Output is correct |
64 |
Correct |
695 ms |
114604 KB |
Output is correct |
65 |
Correct |
708 ms |
125720 KB |
Output is correct |
66 |
Correct |
795 ms |
122168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
506 ms |
110000 KB |
Output is correct |
2 |
Correct |
459 ms |
99912 KB |
Output is correct |
3 |
Correct |
345 ms |
98376 KB |
Output is correct |
4 |
Correct |
452 ms |
109844 KB |
Output is correct |
5 |
Correct |
31 ms |
63060 KB |
Output is correct |
6 |
Correct |
402 ms |
99416 KB |
Output is correct |
7 |
Correct |
145 ms |
71208 KB |
Output is correct |
8 |
Correct |
275 ms |
92972 KB |
Output is correct |
9 |
Correct |
347 ms |
98296 KB |
Output is correct |
10 |
Correct |
356 ms |
98580 KB |
Output is correct |
11 |
Correct |
322 ms |
98408 KB |
Output is correct |
12 |
Correct |
30 ms |
63060 KB |
Output is correct |
13 |
Correct |
32 ms |
62936 KB |
Output is correct |
14 |
Correct |
30 ms |
63000 KB |
Output is correct |
15 |
Correct |
30 ms |
62936 KB |
Output is correct |
16 |
Correct |
36 ms |
62948 KB |
Output is correct |
17 |
Correct |
33 ms |
63060 KB |
Output is correct |
18 |
Correct |
34 ms |
63012 KB |
Output is correct |
19 |
Correct |
31 ms |
63020 KB |
Output is correct |
20 |
Correct |
32 ms |
63052 KB |
Output is correct |
21 |
Correct |
33 ms |
63072 KB |
Output is correct |
22 |
Correct |
32 ms |
62952 KB |
Output is correct |
23 |
Correct |
31 ms |
63036 KB |
Output is correct |
24 |
Correct |
31 ms |
63060 KB |
Output is correct |
25 |
Correct |
35 ms |
63048 KB |
Output is correct |
26 |
Correct |
32 ms |
63048 KB |
Output is correct |
27 |
Correct |
31 ms |
62988 KB |
Output is correct |
28 |
Correct |
34 ms |
63420 KB |
Output is correct |
29 |
Correct |
35 ms |
63660 KB |
Output is correct |
30 |
Correct |
35 ms |
63464 KB |
Output is correct |
31 |
Correct |
42 ms |
63480 KB |
Output is correct |
32 |
Correct |
35 ms |
63436 KB |
Output is correct |
33 |
Correct |
41 ms |
63496 KB |
Output is correct |
34 |
Correct |
36 ms |
63520 KB |
Output is correct |
35 |
Correct |
436 ms |
111304 KB |
Output is correct |
36 |
Correct |
525 ms |
116076 KB |
Output is correct |
37 |
Correct |
441 ms |
111324 KB |
Output is correct |
38 |
Correct |
528 ms |
114448 KB |
Output is correct |
39 |
Correct |
493 ms |
110052 KB |
Output is correct |
40 |
Correct |
335 ms |
98436 KB |
Output is correct |
41 |
Correct |
899 ms |
115296 KB |
Output is correct |
42 |
Correct |
188 ms |
78296 KB |
Output is correct |
43 |
Correct |
307 ms |
92924 KB |
Output is correct |
44 |
Correct |
723 ms |
115000 KB |
Output is correct |
45 |
Correct |
738 ms |
113800 KB |
Output is correct |
46 |
Correct |
837 ms |
115384 KB |
Output is correct |
47 |
Correct |
816 ms |
115312 KB |
Output is correct |
48 |
Correct |
473 ms |
111340 KB |
Output is correct |
49 |
Correct |
644 ms |
115256 KB |
Output is correct |
50 |
Correct |
398 ms |
99540 KB |
Output is correct |
51 |
Correct |
377 ms |
99532 KB |
Output is correct |
52 |
Correct |
34 ms |
62976 KB |
Output is correct |
53 |
Correct |
867 ms |
116032 KB |
Output is correct |
54 |
Correct |
736 ms |
115540 KB |
Output is correct |
55 |
Correct |
766 ms |
114464 KB |
Output is correct |
56 |
Correct |
856 ms |
116240 KB |
Output is correct |
57 |
Correct |
2333 ms |
286200 KB |
Output is correct |
58 |
Correct |
2849 ms |
301496 KB |
Output is correct |
59 |
Correct |
1818 ms |
230604 KB |
Output is correct |
60 |
Correct |
1794 ms |
230496 KB |
Output is correct |
61 |
Correct |
5236 ms |
306004 KB |
Output is correct |
62 |
Correct |
3823 ms |
298368 KB |
Output is correct |
63 |
Correct |
3906 ms |
293156 KB |
Output is correct |
64 |
Correct |
4778 ms |
305916 KB |
Output is correct |
65 |
Correct |
489 ms |
112128 KB |
Output is correct |
66 |
Correct |
561 ms |
114872 KB |
Output is correct |
67 |
Correct |
371 ms |
99076 KB |
Output is correct |
68 |
Correct |
366 ms |
99028 KB |
Output is correct |
69 |
Correct |
840 ms |
115900 KB |
Output is correct |
70 |
Correct |
31 ms |
63060 KB |
Output is correct |
71 |
Correct |
853 ms |
115780 KB |
Output is correct |
72 |
Correct |
695 ms |
114604 KB |
Output is correct |
73 |
Correct |
708 ms |
125720 KB |
Output is correct |
74 |
Correct |
795 ms |
122168 KB |
Output is correct |
75 |
Correct |
2431 ms |
357204 KB |
Output is correct |
76 |
Correct |
2840 ms |
372964 KB |
Output is correct |
77 |
Correct |
1834 ms |
288884 KB |
Output is correct |
78 |
Correct |
1817 ms |
288848 KB |
Output is correct |
79 |
Correct |
5304 ms |
373280 KB |
Output is correct |
80 |
Correct |
3940 ms |
368076 KB |
Output is correct |
81 |
Correct |
3809 ms |
348072 KB |
Output is correct |
82 |
Correct |
5151 ms |
342796 KB |
Output is correct |
83 |
Correct |
5131 ms |
362672 KB |
Output is correct |