#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 1010101
#define MAXS 500
#define INF 1000000020
#define bb ' '
#define ln '\n'
#define Ln '\n'
#define MOD 1000003
struct node {
int mn;
int mn2;
int cnt;
int mnl, mnr;
node(int x = 0, int ind = 0) {
mnl = mnr = ind;
if (!~x) {
mn = mn2 = cnt = -1;
return;
}
mn = x;
mn2 = INF;
cnt = 1;
}
};
inline node operator+(node n1, node n2) {
if (!~n1.cnt) return n2;
if (!~n2.cnt) return n1;
node ret;
ret.mn = min(n1.mn, n2.mn);
ret.cnt = 0;
ret.mnl = INF;
ret.mnr = -INF;
if (ret.mn == n1.mn) ret.cnt += n1.cnt, ret.mnl = min(ret.mnl, n1.mnl), ret.mnr = max(ret.mnr, n1.mnr);
else ret.mn2 = min(ret.mn2, n1.mn);
if (ret.mn == n2.mn) ret.cnt += n2.cnt, ret.mnl = min(ret.mnl, n2.mnl), ret.mnr = max(ret.mnr, n2.mnr);
else ret.mn2 = min(ret.mn2, n2.mn);
ret.mn2 = min(ret.mn2, n1.mn2);
ret.mn2 = min(ret.mn2, n2.mn2);
return ret;
}
int N;
int H[MAX];
int ch[MAX];
namespace segtree {
int N;
node tree[MAX * 4];
int lazy[MAX * 4];
void init(int s, int e, int loc = 1) {
lazy[loc] = -1;
if (s == e) {
tree[loc] = node(H[s], s);
return;
}
int m = s + e >> 1;
init(s, m, loc * 2);
init(m + 1, e, loc * 2 + 1);
tree[loc] = tree[loc * 2] + tree[loc * 2 + 1];
}
inline void prop(int loc) {
for (auto c : { loc * 2, loc * 2 + 1 }) {
tree[c].mn = max(tree[c].mn, lazy[loc]);
lazy[c] = max(lazy[c], lazy[loc]);
assert(tree[c].mn < tree[c].mn2);
}
lazy[loc] = -1;
}
inline void upd(int s, int e, int l, int r, int v, int loc = 1) {
if (s != e) prop(loc);
if (e < l || r < s) return;
if (l <= s && e <= r) {
if (v < tree[loc].mn2) {
if (v > tree[loc].mn) {
tree[loc].mn = v;
lazy[loc] = max(lazy[loc], v);
}
return;
}
}
int m = s + e >> 1;
upd(s, m, l, r, v, loc * 2);
upd(m + 1, e, l, r, v, loc * 2 + 1);
tree[loc] = tree[loc * 2] + tree[loc * 2 + 1];
}
void upd(int low, int r, int v) { upd(1, N, low, r, v); }
inline node query(int s, int e, int l, int r, int loc = 1) {
if (s != e) prop(loc);
if (e < l || r < s) return node(-1);
if (l <= s && e <= r) return tree[loc];
int m = s + e >> 1;
return query(s, m, l, r, loc * 2) + query(m + 1, e, l, r, loc * 2 + 1);
}
inline node query(int l, int r) { return query(1, N, l, r); }
}
inline ll rsum(ll n) { return (n * (n + 1) / 2) % MOD; }
inline ll rsum(ll l, ll r) { return rsum(r) - rsum(l - 1); }
ll naive() {
int i, j;
ll ans = 0;
for (i = 0; i <= 110; i++) {
int l, r;
l = r = -1;
int cnt = 0;
for (j = 1; j <= N; j++) {
if (H[j] != i) continue;
if (ch[j] == H[j]) continue;
cnt++;
if (!~l) l = j;
r = j;
}
if (!cnt) continue;
int lmn = INF;
int rmn = INF;
for (j = 1; j < l; j++) if (H[j] > i) lmn = min(lmn, H[j]);
for (j = r + 1; j <= N; j++) if (H[j] > i) rmn = min(rmn, H[j]);
int mn = INF;
for (j = 1; j <= N; j++) if (H[j] > i) mn = min(mn, H[j]);
if (l == r) {
ans += 0ll + i + lmn + rmn;
H[l]++;
continue;
}
ans += 0ll + lmn + rmn + mn;
ans += 1ll * i * cnt;
ans += 1ll * (2ll * cnt - 3) * (i + 1ll);
for (j = l; j <= r; j++) if (H[j] == i) H[j]++;
}
return ans;
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> N;
segtree::N = N;
int i;
ll ans = 0;
int mv = 1;
for (i = 1; i <= N; i++) cin >> H[i];
for (i = 1; i <= N; i++) if (H[mv] < H[i]) mv = i;
for (i = 1; i <= N; i++) ch[i] = H[i];
for (i = 1; i <= mv; i++) ch[i] = max(ch[i], ch[i - 1]);
for (i = N; i >= mv; i--) ch[i] = max(ch[i], ch[i + 1]);
for (i = 1; i <= N; i++) ans += rsum(H[i], ch[i] - 1), ans %= MOD;
segtree::init(1, N);
int low, high;
low = high = -1;
for (i = 1; i < N; i++) if (H[i] > H[i + 1]) {
low = i;
break;
}
if (!~low) {
cout << 0 << ln;
return 0;
}
for (i = N; i > 1; i--) if (H[i] > H[i - 1]) {
high = i;
break;
}
if (!~high) {
cout << 0 << ln;
return 0;
}
if (low >= high) {
cout << 0 << ln;
return 0;
}
set<int> lst, rst;
for (i = 1; i <= low; i++) lst.insert(H[i]);
for (i = high; i <= N; i++) rst.insert(H[i]);
while (low < high) {
while (low < N && segtree::query(low, low).mn <= segtree::query(low + 1, low + 1).mn) low++, lst.insert(H[low]);
while (high > 1 && segtree::query(high, high).mn <= segtree::query(high - 1, high - 1).mn) high--, rst.insert(H[high]);
if (low >= high) break;
auto res = segtree::query(low + 1, high - 1);
int mn = res.mn;
int n = res.cnt;
auto itl = lst.upper_bound(mn);
auto itr = rst.upper_bound(mn);
int up = min(res.mn2, min(*itl, *itr));
int ml = min(*itl, segtree::query(low, res.mnl).mn2);
int mr = min(*itr, segtree::query(res.mnr, high).mn2);
if (res.cnt == 1) {
ans += 1ll * (ml + mr) * (up - mn);
segtree::upd(low, high, up);
ans %= MOD;
continue;
}
ans += rsum(mn + 1, up) * (n * 2 - 3);
ans %= MOD;
ans += 1ll * (0ll + up + ml + mr) * (up - mn);
ans %= MOD;
segtree::upd(low, high, up);
}
ans %= MOD;
if (ans < 0) ans += MOD;
cout << ans << ln;
}
Compilation message
Main.cpp: In function 'void segtree::init(int, int, int)':
Main.cpp:63:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
63 | int m = s + e >> 1;
| ~~^~~
Main.cpp: In function 'void segtree::upd(int, int, int, int, int, int)':
Main.cpp:88:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
88 | int m = s + e >> 1;
| ~~^~~
Main.cpp: In function 'node segtree::query(int, int, int, int, int)':
Main.cpp:98:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
98 | int m = s + e >> 1;
| ~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
35 |
Correct |
45 ms |
79644 KB |
Output is correct |
36 |
Correct |
46 ms |
79644 KB |
Output is correct |
37 |
Correct |
44 ms |
79632 KB |
Output is correct |
38 |
Correct |
47 ms |
79724 KB |
Output is correct |
39 |
Correct |
46 ms |
79700 KB |
Output is correct |
40 |
Correct |
37 ms |
79492 KB |
Output is correct |
41 |
Correct |
33 ms |
79440 KB |
Output is correct |
42 |
Correct |
33 ms |
79404 KB |
Output is correct |
43 |
Correct |
47 ms |
79668 KB |
Output is correct |
44 |
Correct |
44 ms |
79676 KB |
Output is correct |
45 |
Correct |
44 ms |
79620 KB |
Output is correct |
46 |
Correct |
46 ms |
79724 KB |
Output is correct |
47 |
Correct |
46 ms |
79620 KB |
Output is correct |
48 |
Correct |
45 ms |
79636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
35 |
Correct |
45 ms |
79644 KB |
Output is correct |
36 |
Correct |
46 ms |
79644 KB |
Output is correct |
37 |
Correct |
44 ms |
79632 KB |
Output is correct |
38 |
Correct |
47 ms |
79724 KB |
Output is correct |
39 |
Correct |
46 ms |
79700 KB |
Output is correct |
40 |
Correct |
37 ms |
79492 KB |
Output is correct |
41 |
Correct |
33 ms |
79440 KB |
Output is correct |
42 |
Correct |
33 ms |
79404 KB |
Output is correct |
43 |
Correct |
47 ms |
79668 KB |
Output is correct |
44 |
Correct |
44 ms |
79676 KB |
Output is correct |
45 |
Correct |
44 ms |
79620 KB |
Output is correct |
46 |
Correct |
46 ms |
79724 KB |
Output is correct |
47 |
Correct |
46 ms |
79620 KB |
Output is correct |
48 |
Correct |
45 ms |
79636 KB |
Output is correct |
49 |
Correct |
45 ms |
79644 KB |
Output is correct |
50 |
Correct |
54 ms |
79720 KB |
Output is correct |
51 |
Correct |
47 ms |
79660 KB |
Output is correct |
52 |
Correct |
46 ms |
79672 KB |
Output is correct |
53 |
Correct |
47 ms |
79620 KB |
Output is correct |
54 |
Correct |
34 ms |
79380 KB |
Output is correct |
55 |
Correct |
37 ms |
79436 KB |
Output is correct |
56 |
Correct |
34 ms |
79436 KB |
Output is correct |
57 |
Correct |
44 ms |
79620 KB |
Output is correct |
58 |
Correct |
44 ms |
79648 KB |
Output is correct |
59 |
Correct |
45 ms |
79688 KB |
Output is correct |
60 |
Correct |
46 ms |
79704 KB |
Output is correct |
61 |
Correct |
54 ms |
79656 KB |
Output is correct |
62 |
Correct |
46 ms |
79620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
35 |
Correct |
1821 ms |
95416 KB |
Output is correct |
36 |
Correct |
1862 ms |
95428 KB |
Output is correct |
37 |
Correct |
1730 ms |
95428 KB |
Output is correct |
38 |
Correct |
1748 ms |
95356 KB |
Output is correct |
39 |
Correct |
1832 ms |
95428 KB |
Output is correct |
40 |
Correct |
32 ms |
79316 KB |
Output is correct |
41 |
Correct |
31 ms |
79316 KB |
Output is correct |
42 |
Correct |
830 ms |
95416 KB |
Output is correct |
43 |
Correct |
832 ms |
95300 KB |
Output is correct |
44 |
Correct |
834 ms |
95428 KB |
Output is correct |
45 |
Correct |
1329 ms |
95388 KB |
Output is correct |
46 |
Correct |
1338 ms |
95544 KB |
Output is correct |
47 |
Correct |
1327 ms |
95432 KB |
Output is correct |
48 |
Correct |
1438 ms |
95432 KB |
Output is correct |
49 |
Correct |
1428 ms |
95428 KB |
Output is correct |
50 |
Correct |
1458 ms |
95424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
35 |
Correct |
45 ms |
79644 KB |
Output is correct |
36 |
Correct |
46 ms |
79644 KB |
Output is correct |
37 |
Correct |
44 ms |
79632 KB |
Output is correct |
38 |
Correct |
47 ms |
79724 KB |
Output is correct |
39 |
Correct |
46 ms |
79700 KB |
Output is correct |
40 |
Correct |
37 ms |
79492 KB |
Output is correct |
41 |
Correct |
33 ms |
79440 KB |
Output is correct |
42 |
Correct |
33 ms |
79404 KB |
Output is correct |
43 |
Correct |
47 ms |
79668 KB |
Output is correct |
44 |
Correct |
44 ms |
79676 KB |
Output is correct |
45 |
Correct |
44 ms |
79620 KB |
Output is correct |
46 |
Correct |
46 ms |
79724 KB |
Output is correct |
47 |
Correct |
46 ms |
79620 KB |
Output is correct |
48 |
Correct |
45 ms |
79636 KB |
Output is correct |
49 |
Correct |
1821 ms |
95416 KB |
Output is correct |
50 |
Correct |
1862 ms |
95428 KB |
Output is correct |
51 |
Correct |
1730 ms |
95428 KB |
Output is correct |
52 |
Correct |
1748 ms |
95356 KB |
Output is correct |
53 |
Correct |
1832 ms |
95428 KB |
Output is correct |
54 |
Correct |
32 ms |
79316 KB |
Output is correct |
55 |
Correct |
31 ms |
79316 KB |
Output is correct |
56 |
Correct |
830 ms |
95416 KB |
Output is correct |
57 |
Correct |
832 ms |
95300 KB |
Output is correct |
58 |
Correct |
834 ms |
95428 KB |
Output is correct |
59 |
Correct |
1329 ms |
95388 KB |
Output is correct |
60 |
Correct |
1338 ms |
95544 KB |
Output is correct |
61 |
Correct |
1327 ms |
95432 KB |
Output is correct |
62 |
Correct |
1438 ms |
95432 KB |
Output is correct |
63 |
Correct |
1428 ms |
95428 KB |
Output is correct |
64 |
Correct |
1458 ms |
95424 KB |
Output is correct |
65 |
Correct |
4491 ms |
134616 KB |
Output is correct |
66 |
Execution timed out |
5097 ms |
149072 KB |
Time limit exceeded |
67 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
79404 KB |
Output is correct |
2 |
Correct |
29 ms |
79316 KB |
Output is correct |
3 |
Correct |
30 ms |
79356 KB |
Output is correct |
4 |
Correct |
35 ms |
79432 KB |
Output is correct |
5 |
Correct |
34 ms |
79476 KB |
Output is correct |
6 |
Correct |
33 ms |
79388 KB |
Output is correct |
7 |
Correct |
33 ms |
79444 KB |
Output is correct |
8 |
Correct |
41 ms |
79460 KB |
Output is correct |
9 |
Correct |
30 ms |
79504 KB |
Output is correct |
10 |
Correct |
31 ms |
79496 KB |
Output is correct |
11 |
Correct |
35 ms |
79496 KB |
Output is correct |
12 |
Correct |
35 ms |
79440 KB |
Output is correct |
13 |
Correct |
34 ms |
79488 KB |
Output is correct |
14 |
Correct |
29 ms |
79332 KB |
Output is correct |
15 |
Correct |
31 ms |
79324 KB |
Output is correct |
16 |
Correct |
36 ms |
79392 KB |
Output is correct |
17 |
Correct |
39 ms |
79520 KB |
Output is correct |
18 |
Correct |
36 ms |
79444 KB |
Output is correct |
19 |
Correct |
35 ms |
79440 KB |
Output is correct |
20 |
Correct |
33 ms |
79484 KB |
Output is correct |
21 |
Correct |
33 ms |
79436 KB |
Output is correct |
22 |
Correct |
33 ms |
79492 KB |
Output is correct |
23 |
Correct |
35 ms |
79504 KB |
Output is correct |
24 |
Correct |
38 ms |
79444 KB |
Output is correct |
25 |
Correct |
40 ms |
79384 KB |
Output is correct |
26 |
Correct |
35 ms |
79456 KB |
Output is correct |
27 |
Correct |
36 ms |
79512 KB |
Output is correct |
28 |
Correct |
34 ms |
79444 KB |
Output is correct |
29 |
Correct |
30 ms |
79308 KB |
Output is correct |
30 |
Correct |
30 ms |
79308 KB |
Output is correct |
31 |
Correct |
30 ms |
79344 KB |
Output is correct |
32 |
Correct |
30 ms |
79352 KB |
Output is correct |
33 |
Correct |
31 ms |
79260 KB |
Output is correct |
34 |
Correct |
31 ms |
79456 KB |
Output is correct |
35 |
Correct |
45 ms |
79644 KB |
Output is correct |
36 |
Correct |
46 ms |
79644 KB |
Output is correct |
37 |
Correct |
44 ms |
79632 KB |
Output is correct |
38 |
Correct |
47 ms |
79724 KB |
Output is correct |
39 |
Correct |
46 ms |
79700 KB |
Output is correct |
40 |
Correct |
37 ms |
79492 KB |
Output is correct |
41 |
Correct |
33 ms |
79440 KB |
Output is correct |
42 |
Correct |
33 ms |
79404 KB |
Output is correct |
43 |
Correct |
47 ms |
79668 KB |
Output is correct |
44 |
Correct |
44 ms |
79676 KB |
Output is correct |
45 |
Correct |
44 ms |
79620 KB |
Output is correct |
46 |
Correct |
46 ms |
79724 KB |
Output is correct |
47 |
Correct |
46 ms |
79620 KB |
Output is correct |
48 |
Correct |
45 ms |
79636 KB |
Output is correct |
49 |
Correct |
45 ms |
79644 KB |
Output is correct |
50 |
Correct |
54 ms |
79720 KB |
Output is correct |
51 |
Correct |
47 ms |
79660 KB |
Output is correct |
52 |
Correct |
46 ms |
79672 KB |
Output is correct |
53 |
Correct |
47 ms |
79620 KB |
Output is correct |
54 |
Correct |
34 ms |
79380 KB |
Output is correct |
55 |
Correct |
37 ms |
79436 KB |
Output is correct |
56 |
Correct |
34 ms |
79436 KB |
Output is correct |
57 |
Correct |
44 ms |
79620 KB |
Output is correct |
58 |
Correct |
44 ms |
79648 KB |
Output is correct |
59 |
Correct |
45 ms |
79688 KB |
Output is correct |
60 |
Correct |
46 ms |
79704 KB |
Output is correct |
61 |
Correct |
54 ms |
79656 KB |
Output is correct |
62 |
Correct |
46 ms |
79620 KB |
Output is correct |
63 |
Correct |
1821 ms |
95416 KB |
Output is correct |
64 |
Correct |
1862 ms |
95428 KB |
Output is correct |
65 |
Correct |
1730 ms |
95428 KB |
Output is correct |
66 |
Correct |
1748 ms |
95356 KB |
Output is correct |
67 |
Correct |
1832 ms |
95428 KB |
Output is correct |
68 |
Correct |
32 ms |
79316 KB |
Output is correct |
69 |
Correct |
31 ms |
79316 KB |
Output is correct |
70 |
Correct |
830 ms |
95416 KB |
Output is correct |
71 |
Correct |
832 ms |
95300 KB |
Output is correct |
72 |
Correct |
834 ms |
95428 KB |
Output is correct |
73 |
Correct |
1329 ms |
95388 KB |
Output is correct |
74 |
Correct |
1338 ms |
95544 KB |
Output is correct |
75 |
Correct |
1327 ms |
95432 KB |
Output is correct |
76 |
Correct |
1438 ms |
95432 KB |
Output is correct |
77 |
Correct |
1428 ms |
95428 KB |
Output is correct |
78 |
Correct |
1458 ms |
95424 KB |
Output is correct |
79 |
Correct |
4491 ms |
134616 KB |
Output is correct |
80 |
Execution timed out |
5097 ms |
149072 KB |
Time limit exceeded |
81 |
Halted |
0 ms |
0 KB |
- |