#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
constexpr ll INF = 4e18;
constexpr int MOD = 1e6 + 3;
int n;
ll a[1001000], b[1001000];
vector<array<int, 2>> Ev[1001000];
struct Seg{
ll tree[2002000];
int sz;
void init(int n){
sz = n;
for (int i=sz;i<sz*2;i++) tree[i] = a[i-sz];
for (int i=sz-1;i;i--) tree[i] = min(tree[i<<1], tree[i<<1|1]);
}
void update(int p, ll x){
p += sz;
tree[p] = x;
for (p>>=1;p;p>>=1) tree[p] = min(tree[p<<1], tree[p<<1|1]);
}
ll query(int l, int r){
++r;
ll ret = INF;
for (l+=sz, r+=sz;l<r;l>>=1, r>>=1){
if (l&1) ret = min(ret, tree[l++]);
if (r&1) ret = min(ret, tree[--r]);
}
return ret;
}
}tree;
void genB(){
int idx = max_element(a+1, a+n+1) - a;
int cur = 0;
for (int i=1;i<=idx;i++){
if (cur <= a[i]){
b[i] = a[i];
cur = a[i];
}
else b[i] = cur;
}
cur = 0;
for (int i=n;i>=idx;i--){
if (cur <= a[i]){
b[i] = a[i];
cur = a[i];
}
else b[i] = cur;
}
}
ll rans;
int cnt;
void dfs(vector<int> A, ll cur){
cnt++;
if (cnt > 1e5) {rans = -1; return;}
// for (auto &x:A) printf("%d ", x);
// printf("-> %lld\n", cur);
int idx = max_element(A.begin(), A.end()) - A.begin();
bool flag = 1;
for (int i=0;i<idx;i++) if (A[i] > A[i+1]) flag = 0;
for (int i=(int)A.size()-1;i>idx;i--) if (A[i] > A[i-1]) flag = 0;
if (flag){
// printf("ok cur = %lld\n", cur);
rans = min(rans, cur);
return;
}
for (int i=0;i<(int)A.size();i++){
for (int j=i+1;j<(int)A.size();j++){
for (int k=j+1;k<(int)A.size();k++){
cnt++;
if (cnt > 1e5) {rans = -1; return;}
if (A[i] > A[j] && A[j] < A[k]){
cur += A[i] + A[j] + A[k];
A[j]++;
dfs(A, cur);
A[j]--;
cur -= A[i] + A[j] + A[k];
}
// if (i==0 && j==1 && k==6) printf("ok %d %d %d\n", A[i], A[j], A[k]);
}
}
}
}
ll naive(){
cnt = 0;
vector<int> A;
for (int i=1;i<=n;i++) A.push_back(a[i]);
rans = INF;
dfs(A, 0);
return rans;
}
ll sum(ll l, ll r){
assert(l<=r);
assert(r < (int)(1e9 + 100));
return (r*(r+1) / 2 - l*(l-1) / 2) % MOD;
}
ll solve(){
a[0] = INF;
// int H = *max_element(a+1, a+n+1);
for (int i=1;i<=n;i++) Ev[i].clear();
// scanf("%d", &n);
// for (int i=1;i<=n;i++) scanf("%lld", a+i);
// printf("%lld\n", naive());
genB();
vector<int> C;
for (int i=1;i<=n;i++){
C.push_back(a[i]);
C.push_back(b[i]);
}
C.push_back(0);
sort(C.begin(), C.end());
C.erase(unique(C.begin(), C.end()), C.end());
for (int i=1;i<=n;i++){
int tmp1 = lower_bound(C.begin(), C.end(), a[i]) - C.begin();
int tmp2 = lower_bound(C.begin(), C.end(), b[i]) - C.begin();
Ev[tmp1].push_back({0, i});
Ev[tmp2].push_back({1, i});
// assert(a[i] <= b[i]);
// assert(b[i] <= H);
}
multiset<int> st;
tree.init(n+1);
ll ans = 0;
for (int i=1;i<(int)C.size();i++){
sort(Ev[i].begin(), Ev[i].end());
for (auto &[typ, pos]:Ev[i]){
if (typ==0){
tree.update(pos, INF);
st.insert(pos);
}
else{
st.erase(st.find(pos));
}
}
int cnt = st.size();
if (cnt==0) continue;
int s = *st.begin(), e = *st.rbegin();
ll p0 = tree.query(1, s-1), pk = tree.query(e+1, n), p = tree.query(1, n);
// printf("\n%d -> %d:\n", i, i+1);
// for (auto &x:st) printf("%d ", x);
// printf("\n");
// printf(" ok %lld %lld %lld\n", p0, pk, p);
assert(p0 < INF && pk < INF && p < INF);
assert(p0 > i && pk > i && p > i);
if (cnt >= 2){
ans += (p0 + pk + p) * (C[i+1] - C[i]);
ans %= MOD;
ans += sum(C[i]+1, C[i+1]) * (cnt*2 - 3);
ans %= MOD;
ans += sum(C[i], C[i+1]-1) * cnt;
ans %= MOD;
}
else{
ans += (p0 + pk) * (C[i+1] - C[i]);
ans %= MOD;
ans += sum(C[i], C[i+1]-1) * cnt;
ans %= MOD;
}
// if (cnt >= 2) ans += p0 + pk + p + (ll)(i+1) * (cnt*2 - 3) + (ll)i*cnt;
// else ans += p0 + pk + i;
// ans %= MOD;
}
return ans;
}
mt19937 seed(69);
uniform_int_distribution<int> rng(0, 2147483647);
int getrand(int l, int r){return rng(seed) % (r-l+1) + l;}
void gen(){
n = getrand(1, 7);
for (int i=1;i<=n;i++) a[i] = getrand(1, 10);
}
void stress(int tc){
printf("--------------------------------------\n");
printf("Stress #%d\n", tc);
gen();
printf("Input:\n");
printf("%d\n", n);
for (int i=1;i<=n;i++) printf("%lld ", a[i]);
printf("\n");
ll ans = naive();
ll out = solve();
printf("Answer: %lld\n", ans);
printf("Output: %lld\n", out);
// if (ans!=out && ans!=-1){
// printf("--------------------------------------\n");
// printf("Stress #%d\n", tc);
// printf("Input:\n");
// printf("%d\n", n);
// for (int i=1;i<=n;i++) printf("%lld ", a[i]);
// printf("\n");
// printf("Answer: %lld\n", ans);
// printf("Output: %lld\n", out);
// }
if (tc%10000==0) printf("ok %d done\n", tc);
assert(ans==out || ans==-1);
}
signed main(){
// for (int i=1;;i++) stress(i);
scanf("%lld", &n);
for (int i=1;i<=n;i++) scanf("%lld", a+i);
printf("%lld\n", solve());
}
Compilation message
Main.cpp: In function 'void stress(long long int)':
Main.cpp:230:19: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
230 | printf("Stress #%d\n", tc);
| ~^ ~~
| | |
| int long long int
| %lld
Main.cpp:234:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
234 | printf("%d\n", n);
| ~^ ~
| | |
| int long long int
| %lld
Main.cpp:256:31: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
256 | if (tc%10000==0) printf("ok %d done\n", tc);
| ~^ ~~
| | |
| int long long int
| %lld
Main.cpp: In function 'int main()':
Main.cpp:264:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
264 | scanf("%lld", &n);
| ~~~~~^~~~~~~~~~~~
Main.cpp:265:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
265 | for (int i=1;i<=n;i++) scanf("%lld", a+i);
| ~~~~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
35 |
Correct |
13 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
13 ms |
24532 KB |
Output is correct |
38 |
Correct |
14 ms |
24476 KB |
Output is correct |
39 |
Correct |
17 ms |
24540 KB |
Output is correct |
40 |
Correct |
12 ms |
24404 KB |
Output is correct |
41 |
Correct |
12 ms |
24404 KB |
Output is correct |
42 |
Correct |
12 ms |
24496 KB |
Output is correct |
43 |
Correct |
13 ms |
24504 KB |
Output is correct |
44 |
Correct |
13 ms |
24532 KB |
Output is correct |
45 |
Correct |
16 ms |
24548 KB |
Output is correct |
46 |
Correct |
13 ms |
24496 KB |
Output is correct |
47 |
Correct |
16 ms |
24532 KB |
Output is correct |
48 |
Correct |
12 ms |
24532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
35 |
Correct |
13 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
13 ms |
24532 KB |
Output is correct |
38 |
Correct |
14 ms |
24476 KB |
Output is correct |
39 |
Correct |
17 ms |
24540 KB |
Output is correct |
40 |
Correct |
12 ms |
24404 KB |
Output is correct |
41 |
Correct |
12 ms |
24404 KB |
Output is correct |
42 |
Correct |
12 ms |
24496 KB |
Output is correct |
43 |
Correct |
13 ms |
24504 KB |
Output is correct |
44 |
Correct |
13 ms |
24532 KB |
Output is correct |
45 |
Correct |
16 ms |
24548 KB |
Output is correct |
46 |
Correct |
13 ms |
24496 KB |
Output is correct |
47 |
Correct |
16 ms |
24532 KB |
Output is correct |
48 |
Correct |
12 ms |
24532 KB |
Output is correct |
49 |
Correct |
13 ms |
24484 KB |
Output is correct |
50 |
Correct |
18 ms |
24476 KB |
Output is correct |
51 |
Correct |
15 ms |
24532 KB |
Output is correct |
52 |
Correct |
13 ms |
24500 KB |
Output is correct |
53 |
Correct |
16 ms |
24532 KB |
Output is correct |
54 |
Correct |
14 ms |
24404 KB |
Output is correct |
55 |
Correct |
12 ms |
24404 KB |
Output is correct |
56 |
Correct |
11 ms |
24472 KB |
Output is correct |
57 |
Correct |
13 ms |
24516 KB |
Output is correct |
58 |
Correct |
15 ms |
24488 KB |
Output is correct |
59 |
Correct |
13 ms |
24532 KB |
Output is correct |
60 |
Correct |
13 ms |
24512 KB |
Output is correct |
61 |
Correct |
13 ms |
24488 KB |
Output is correct |
62 |
Correct |
15 ms |
24420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
35 |
Correct |
1081 ms |
156652 KB |
Output is correct |
36 |
Correct |
1046 ms |
156656 KB |
Output is correct |
37 |
Correct |
1069 ms |
156868 KB |
Output is correct |
38 |
Correct |
1038 ms |
156532 KB |
Output is correct |
39 |
Correct |
1062 ms |
156360 KB |
Output is correct |
40 |
Correct |
11 ms |
23784 KB |
Output is correct |
41 |
Correct |
13 ms |
23880 KB |
Output is correct |
42 |
Correct |
528 ms |
152908 KB |
Output is correct |
43 |
Correct |
504 ms |
152968 KB |
Output is correct |
44 |
Correct |
517 ms |
153404 KB |
Output is correct |
45 |
Correct |
547 ms |
156900 KB |
Output is correct |
46 |
Correct |
556 ms |
156908 KB |
Output is correct |
47 |
Correct |
559 ms |
156932 KB |
Output is correct |
48 |
Correct |
724 ms |
156852 KB |
Output is correct |
49 |
Correct |
659 ms |
156972 KB |
Output is correct |
50 |
Correct |
620 ms |
157024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
35 |
Correct |
13 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
13 ms |
24532 KB |
Output is correct |
38 |
Correct |
14 ms |
24476 KB |
Output is correct |
39 |
Correct |
17 ms |
24540 KB |
Output is correct |
40 |
Correct |
12 ms |
24404 KB |
Output is correct |
41 |
Correct |
12 ms |
24404 KB |
Output is correct |
42 |
Correct |
12 ms |
24496 KB |
Output is correct |
43 |
Correct |
13 ms |
24504 KB |
Output is correct |
44 |
Correct |
13 ms |
24532 KB |
Output is correct |
45 |
Correct |
16 ms |
24548 KB |
Output is correct |
46 |
Correct |
13 ms |
24496 KB |
Output is correct |
47 |
Correct |
16 ms |
24532 KB |
Output is correct |
48 |
Correct |
12 ms |
24532 KB |
Output is correct |
49 |
Correct |
1081 ms |
156652 KB |
Output is correct |
50 |
Correct |
1046 ms |
156656 KB |
Output is correct |
51 |
Correct |
1069 ms |
156868 KB |
Output is correct |
52 |
Correct |
1038 ms |
156532 KB |
Output is correct |
53 |
Correct |
1062 ms |
156360 KB |
Output is correct |
54 |
Correct |
11 ms |
23784 KB |
Output is correct |
55 |
Correct |
13 ms |
23880 KB |
Output is correct |
56 |
Correct |
528 ms |
152908 KB |
Output is correct |
57 |
Correct |
504 ms |
152968 KB |
Output is correct |
58 |
Correct |
517 ms |
153404 KB |
Output is correct |
59 |
Correct |
547 ms |
156900 KB |
Output is correct |
60 |
Correct |
556 ms |
156908 KB |
Output is correct |
61 |
Correct |
559 ms |
156932 KB |
Output is correct |
62 |
Correct |
724 ms |
156852 KB |
Output is correct |
63 |
Correct |
659 ms |
156972 KB |
Output is correct |
64 |
Correct |
620 ms |
157024 KB |
Output is correct |
65 |
Correct |
2072 ms |
159940 KB |
Output is correct |
66 |
Correct |
2076 ms |
160888 KB |
Output is correct |
67 |
Correct |
2037 ms |
159980 KB |
Output is correct |
68 |
Correct |
2082 ms |
160088 KB |
Output is correct |
69 |
Correct |
1928 ms |
160016 KB |
Output is correct |
70 |
Correct |
543 ms |
152488 KB |
Output is correct |
71 |
Correct |
506 ms |
152944 KB |
Output is correct |
72 |
Correct |
539 ms |
153460 KB |
Output is correct |
73 |
Correct |
695 ms |
159992 KB |
Output is correct |
74 |
Correct |
711 ms |
160052 KB |
Output is correct |
75 |
Correct |
720 ms |
159984 KB |
Output is correct |
76 |
Correct |
1051 ms |
160020 KB |
Output is correct |
77 |
Correct |
1121 ms |
159836 KB |
Output is correct |
78 |
Correct |
1092 ms |
159788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23752 KB |
Output is correct |
2 |
Correct |
13 ms |
23776 KB |
Output is correct |
3 |
Correct |
13 ms |
23848 KB |
Output is correct |
4 |
Correct |
12 ms |
24404 KB |
Output is correct |
5 |
Correct |
11 ms |
24464 KB |
Output is correct |
6 |
Correct |
12 ms |
24488 KB |
Output is correct |
7 |
Correct |
12 ms |
24400 KB |
Output is correct |
8 |
Correct |
11 ms |
24404 KB |
Output is correct |
9 |
Correct |
11 ms |
24276 KB |
Output is correct |
10 |
Correct |
12 ms |
24276 KB |
Output is correct |
11 |
Correct |
12 ms |
24448 KB |
Output is correct |
12 |
Correct |
12 ms |
24404 KB |
Output is correct |
13 |
Correct |
14 ms |
24476 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
13 ms |
23764 KB |
Output is correct |
16 |
Correct |
12 ms |
24404 KB |
Output is correct |
17 |
Correct |
13 ms |
24428 KB |
Output is correct |
18 |
Correct |
13 ms |
24404 KB |
Output is correct |
19 |
Correct |
14 ms |
24420 KB |
Output is correct |
20 |
Correct |
15 ms |
24460 KB |
Output is correct |
21 |
Correct |
16 ms |
24396 KB |
Output is correct |
22 |
Correct |
13 ms |
24376 KB |
Output is correct |
23 |
Correct |
13 ms |
24404 KB |
Output is correct |
24 |
Correct |
15 ms |
24404 KB |
Output is correct |
25 |
Correct |
12 ms |
24404 KB |
Output is correct |
26 |
Correct |
13 ms |
24468 KB |
Output is correct |
27 |
Correct |
13 ms |
24384 KB |
Output is correct |
28 |
Correct |
16 ms |
24460 KB |
Output is correct |
29 |
Correct |
11 ms |
23836 KB |
Output is correct |
30 |
Correct |
11 ms |
23812 KB |
Output is correct |
31 |
Correct |
11 ms |
23708 KB |
Output is correct |
32 |
Correct |
11 ms |
23760 KB |
Output is correct |
33 |
Correct |
10 ms |
23764 KB |
Output is correct |
34 |
Correct |
10 ms |
23844 KB |
Output is correct |
35 |
Correct |
13 ms |
24532 KB |
Output is correct |
36 |
Correct |
13 ms |
24532 KB |
Output is correct |
37 |
Correct |
13 ms |
24532 KB |
Output is correct |
38 |
Correct |
14 ms |
24476 KB |
Output is correct |
39 |
Correct |
17 ms |
24540 KB |
Output is correct |
40 |
Correct |
12 ms |
24404 KB |
Output is correct |
41 |
Correct |
12 ms |
24404 KB |
Output is correct |
42 |
Correct |
12 ms |
24496 KB |
Output is correct |
43 |
Correct |
13 ms |
24504 KB |
Output is correct |
44 |
Correct |
13 ms |
24532 KB |
Output is correct |
45 |
Correct |
16 ms |
24548 KB |
Output is correct |
46 |
Correct |
13 ms |
24496 KB |
Output is correct |
47 |
Correct |
16 ms |
24532 KB |
Output is correct |
48 |
Correct |
12 ms |
24532 KB |
Output is correct |
49 |
Correct |
13 ms |
24484 KB |
Output is correct |
50 |
Correct |
18 ms |
24476 KB |
Output is correct |
51 |
Correct |
15 ms |
24532 KB |
Output is correct |
52 |
Correct |
13 ms |
24500 KB |
Output is correct |
53 |
Correct |
16 ms |
24532 KB |
Output is correct |
54 |
Correct |
14 ms |
24404 KB |
Output is correct |
55 |
Correct |
12 ms |
24404 KB |
Output is correct |
56 |
Correct |
11 ms |
24472 KB |
Output is correct |
57 |
Correct |
13 ms |
24516 KB |
Output is correct |
58 |
Correct |
15 ms |
24488 KB |
Output is correct |
59 |
Correct |
13 ms |
24532 KB |
Output is correct |
60 |
Correct |
13 ms |
24512 KB |
Output is correct |
61 |
Correct |
13 ms |
24488 KB |
Output is correct |
62 |
Correct |
15 ms |
24420 KB |
Output is correct |
63 |
Correct |
1081 ms |
156652 KB |
Output is correct |
64 |
Correct |
1046 ms |
156656 KB |
Output is correct |
65 |
Correct |
1069 ms |
156868 KB |
Output is correct |
66 |
Correct |
1038 ms |
156532 KB |
Output is correct |
67 |
Correct |
1062 ms |
156360 KB |
Output is correct |
68 |
Correct |
11 ms |
23784 KB |
Output is correct |
69 |
Correct |
13 ms |
23880 KB |
Output is correct |
70 |
Correct |
528 ms |
152908 KB |
Output is correct |
71 |
Correct |
504 ms |
152968 KB |
Output is correct |
72 |
Correct |
517 ms |
153404 KB |
Output is correct |
73 |
Correct |
547 ms |
156900 KB |
Output is correct |
74 |
Correct |
556 ms |
156908 KB |
Output is correct |
75 |
Correct |
559 ms |
156932 KB |
Output is correct |
76 |
Correct |
724 ms |
156852 KB |
Output is correct |
77 |
Correct |
659 ms |
156972 KB |
Output is correct |
78 |
Correct |
620 ms |
157024 KB |
Output is correct |
79 |
Correct |
2072 ms |
159940 KB |
Output is correct |
80 |
Correct |
2076 ms |
160888 KB |
Output is correct |
81 |
Correct |
2037 ms |
159980 KB |
Output is correct |
82 |
Correct |
2082 ms |
160088 KB |
Output is correct |
83 |
Correct |
1928 ms |
160016 KB |
Output is correct |
84 |
Correct |
543 ms |
152488 KB |
Output is correct |
85 |
Correct |
506 ms |
152944 KB |
Output is correct |
86 |
Correct |
539 ms |
153460 KB |
Output is correct |
87 |
Correct |
695 ms |
159992 KB |
Output is correct |
88 |
Correct |
711 ms |
160052 KB |
Output is correct |
89 |
Correct |
720 ms |
159984 KB |
Output is correct |
90 |
Correct |
1051 ms |
160020 KB |
Output is correct |
91 |
Correct |
1121 ms |
159836 KB |
Output is correct |
92 |
Correct |
1092 ms |
159788 KB |
Output is correct |
93 |
Correct |
542 ms |
152484 KB |
Output is correct |
94 |
Correct |
870 ms |
164712 KB |
Output is correct |
95 |
Correct |
746 ms |
164712 KB |
Output is correct |
96 |
Correct |
783 ms |
164712 KB |
Output is correct |
97 |
Correct |
1065 ms |
164328 KB |
Output is correct |
98 |
Correct |
987 ms |
164504 KB |
Output is correct |
99 |
Correct |
1004 ms |
164356 KB |
Output is correct |
100 |
Correct |
2037 ms |
165456 KB |
Output is correct |
101 |
Correct |
2085 ms |
164720 KB |
Output is correct |
102 |
Correct |
2084 ms |
164768 KB |
Output is correct |
103 |
Correct |
2032 ms |
164552 KB |
Output is correct |
104 |
Correct |
2152 ms |
164696 KB |
Output is correct |
105 |
Correct |
552 ms |
152948 KB |
Output is correct |
106 |
Correct |
504 ms |
152972 KB |
Output is correct |