QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#19525 | #2468. Izbori | Qingyu | 110 ✓ | 204ms | 55200kb | C++20 | 1.5kb | 2022-02-03 09:21:33 | 2022-05-06 05:41:21 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
constexpr int N = 150'0005;
int n, a[N], b[N], c1[N], c2[N], c3[N], ans, B, op;
std::vector<int> p[N];
int sum(int x)
{
int an = 0;
for (int i = x; i; i -= i & -i)
an += c1[i] * (x + 2) * (x + 1) - c2[i] * (2 * x + 3) + c3[i];
return an / 2;
}
void add(int x, int v)
{
for (int i = x ; i <= B + n; i += i & -i)
c1[i] += v,
c2[i] += v * x,
c3[i] += v * x * x;
}
signed main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
std::cin >> n;
for (int i = 1; i <= n; i++)
{
std::cin >> a[i];
b[i] = a[i];
}
std::sort(b + 1, b + n + 1);
int m = std::unique(b + 1, b + n + 1) - (b + 1);
for (int i = 1; i <= n; ++i) {
a[i] = std::lower_bound(b + 1, b + n + 1, a[i]) - b - 1;
p[a[i]].push_back(i);
}
B = n + 1;
for (int i = 0; i < n; i++)
{
p[i].push_back(n + 1);
for (int j = 0, lst = 0; j < (int)p[i].size(); j++)
{
int y = 2 * j - lst + B, x = 2 * j - (p[i][j] - 1) + B;
ans += sum(y - 1) - (x >= 3 ? sum(x - 2) : 0);
add(x, 1), add(y + 1, -1);
lst = p[i][j];
}
for (int j = 0, lst = 0; j < (int)p[i].size(); j++)
{
int y = 2 * j - lst + B, x = 2 * j - (p[i][j] - 1) + B;
add(x, -1), add(y + 1, 1);
lst = p[i][j];
}
}
std::cout << ans;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 3ms
memory: 38736kb
input:
10 942147545 450336559 589072061 942414770 141868244 766117816 508242564 347873370 140196153 821766606
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 9ms
memory: 38876kb
input:
54 264953107 710871026 127613793 330383594 959916515 527698510 12467368 968653459 323910722 982925411 617117566 780134304 429894519 526372444 533225841 722309413 350921201 310828901 323216832 588705028 336638196 91905162 321271272 35321133 106224862 112130636 981211759 51063180 4567862 801415746 997...
output:
54
result:
ok single line: '54'
Test #3:
score: 0
Accepted
time: 7ms
memory: 38816kb
input:
300 5 1 2 1 2 4 4 5 1 2 1 2 4 5 1 3 3 3 5 1 2 5 4 3 4 5 5 2 3 1 4 2 5 3 2 5 5 5 4 1 5 1 4 5 4 4 3 4 5 1 5 1 4 2 1 4 3 3 5 1 4 1 3 3 1 4 5 1 5 2 2 1 1 5 1 5 5 2 1 2 1 5 3 1 4 4 2 2 3 2 4 3 4 2 2 3 2 3 2 1 2 3 3 1 4 5 4 5 4 4 2 5 4 1 2 5 2 4 4 3 1 5 4 4 3 5 4 1 4 1 5 1 2 5 4 5 5 1 1 3 2 2 4 4 3 1 2 3 ...
output:
695
result:
ok single line: '695'
Test #4:
score: 0
Accepted
time: 13ms
memory: 38772kb
input:
300 2 4 2 1 3 4 4 3 5 5 1 3 3 3 3 4 2 4 5 1 5 5 1 5 4 5 4 1 4 2 2 3 4 5 2 3 4 1 5 1 4 2 3 1 1 5 3 4 4 2 5 3 3 4 1 5 5 3 2 2 1 2 4 2 4 3 5 1 4 3 1 1 2 5 3 1 1 2 1 5 2 1 5 2 5 1 1 5 5 3 2 4 4 5 3 2 5 5 5 4 5 2 5 3 3 5 3 4 1 4 5 4 5 4 2 3 2 1 2 5 4 5 2 3 4 4 2 1 4 2 3 4 3 2 4 3 3 4 5 5 4 2 2 1 2 5 3 2 ...
output:
765
result:
ok single line: '765'
Test #5:
score: 0
Accepted
time: 8ms
memory: 38792kb
input:
300 4 3 3 2 4 1 1 5 1 1 4 4 4 4 5 2 5 4 5 2 5 3 5 2 2 4 3 2 2 4 3 4 4 2 2 2 3 4 5 1 3 3 2 4 2 4 2 4 3 5 3 2 4 3 4 1 3 3 2 3 4 3 3 2 5 4 3 1 2 3 4 3 2 5 2 5 4 1 2 5 3 4 3 3 5 2 4 5 2 4 4 2 1 2 2 4 1 5 1 1 1 5 2 3 3 3 4 3 3 4 1 3 4 3 5 3 2 4 5 1 1 4 5 2 4 2 2 2 1 1 4 2 4 5 2 4 5 4 4 3 2 5 1 4 2 2 3 2 ...
output:
746
result:
ok single line: '746'
Test #6:
score: 0
Accepted
time: 4ms
memory: 38948kb
input:
300 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941753 511941...
output:
45150
result:
ok single line: '45150'
Subtask #2:
score: 15
Accepted
Test #7:
score: 15
Accepted
time: 13ms
memory: 38988kb
input:
921 524767688 509815977 594114825 991570522 991979961 544018125 777680993 983750838 95962635 531067495 150617691 492786314 158077719 497465369 741403989 459469418 977138578 151552739 702032898 475129961 244853392 202522013 917454821 365887956 487159109 141392137 134488324 185031598 38901169 31318575...
output:
921
result:
ok single line: '921'
Test #8:
score: 0
Accepted
time: 4ms
memory: 38800kb
input:
113 11525661 814159820 814455014 318679215 73900782 755782909 951444067 332912132 847555068 771746629 643435402 475633506 273797309 95719366 755438329 758284588 865563687 98134440 535203203 694756773 984900332 8553198 274808627 220290750 778856671 778869826 158870574 935509152 467944260 776608190 37...
output:
113
result:
ok single line: '113'
Test #9:
score: 0
Accepted
time: 4ms
memory: 39044kb
input:
2000 999999993 999999997 1000000000 1000000000 999999991 999999993 999999992 999999992 999999993 1000000000 1000000000 1000000000 999999998 999999990 1000000000 999999992 999999993 999999998 999999995 999999999 999999997 999999993 999999992 999999991 999999992 999999995 1000000000 1000000000 9999999...
output:
3101
result:
ok single line: '3101'
Test #10:
score: 0
Accepted
time: 15ms
memory: 38996kb
input:
2000 999999997 999999995 999999994 999999998 999999995 999999997 999999991 999999999 999999997 999999997 999999994 999999993 999999997 999999995 999999997 999999992 999999993 999999996 999999992 999999990 999999998 999999998 999999992 999999991 999999998 999999999 999999995 999999998 999999990 99999...
output:
2957
result:
ok single line: '2957'
Test #11:
score: 0
Accepted
time: 12ms
memory: 38988kb
input:
2000 999999990 999999990 1000000000 999999997 1000000000 1000000000 999999994 999999999 999999991 999999992 999999999 999999995 999999990 999999999 999999997 999999999 999999994 999999995 999999995 999999994 999999991 999999994 999999996 999999999 999999998 999999994 999999991 999999992 999999997 99...
output:
3057
result:
ok single line: '3057'
Test #12:
score: 0
Accepted
time: 11ms
memory: 38968kb
input:
2000 999999994 1000000000 999999994 999999994 999999994 1000000000 999999999 999999990 999999992 999999997 999999991 999999994 999999999 999999994 999999992 999999999 999999999 999999994 999999992 999999995 999999992 999999997 1000000000 999999991 999999994 999999993 999999992 999999992 999999992 99...
output:
2970
result:
ok single line: '2970'
Test #13:
score: 0
Accepted
time: 18ms
memory: 39028kb
input:
2000 999999991 999999990 999999990 999999998 999999995 999999994 999999999 1000000000 999999995 999999992 1000000000 999999991 999999990 999999990 999999998 999999991 999999994 999999990 999999997 999999990 999999997 999999997 999999991 999999991 999999997 999999996 999999999 999999998 1000000000 99...
output:
3026
result:
ok single line: '3026'
Test #14:
score: 0
Accepted
time: 8ms
memory: 39008kb
input:
2000 999999995 999999990 999999992 999999994 999999991 999999998 999999994 999999999 999999990 999999996 999999993 999999992 999999993 999999993 999999992 999999993 999999997 999999993 999999992 999999990 1000000000 999999992 999999993 999999997 1000000000 1000000000 999999993 1000000000 1000000000 ...
output:
3145
result:
ok single line: '3145'
Test #15:
score: 0
Accepted
time: 8ms
memory: 38972kb
input:
2000 999999998 999999995 999999999 999999992 999999990 999999997 999999997 999999998 1000000000 1000000000 999999997 999999995 999999993 1000000000 999999998 999999992 1000000000 999999996 999999993 999999993 999999996 999999997 999999995 999999993 999999993 999999994 999999990 999999990 999999997 9...
output:
2983
result:
ok single line: '2983'
Test #16:
score: 0
Accepted
time: 4ms
memory: 38940kb
input:
2000 999999994 999999999 999999990 999999996 999999993 999999993 999999999 999999997 999999990 999999995 999999997 999999993 999999998 999999991 999999994 999999992 999999993 999999995 999999996 999999995 1000000000 999999990 1000000000 999999998 999999999 999999994 999999996 999999991 999999995 999...
output:
3042
result:
ok single line: '3042'
Test #17:
score: 0
Accepted
time: 8ms
memory: 38964kb
input:
2000 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 268355411 26835...
output:
2001000
result:
ok single line: '2001000'
Subtask #3:
score: 15
Accepted
Test #18:
score: 15
Accepted
time: 79ms
memory: 45956kb
input:
132639 1 2 1 2 2 2 2 2 2 1 2 2 2 1 2 2 1 2 1 1 2 1 1 1 2 1 2 2 2 2 1 1 2 2 1 2 1 2 2 1 2 1 2 2 1 2 1 1 1 2 1 2 1 2 2 1 1 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 1 1 1 2 2 1 1 1 2 2 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 2 1 1 2 1 2 2 2 2 2 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 2 1 1 1 2 1 2 2 1 2 1 1 2...
output:
8783382170
result:
ok single line: '8783382170'
Test #19:
score: 0
Accepted
time: 90ms
memory: 48344kb
input:
173817 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 1 1 1 1 2 1 1 2 2 1 2 2 2 2 1 2 1 1 2 2 2 2 2 1 1 2 1 1 1 1 1 1 2 1 2 2 1 2 2 1 1 1 2 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 1 1 1 2 1 2 1 1 2 2 1 2 2 2 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2 2 1 1 1 2 1 2 1 2 2 1 2 1 1 1 2 2 1 2 1 1 1 1 2 2 2 2 2 1...
output:
15075709853
result:
ok single line: '15075709853'
Test #20:
score: 0
Accepted
time: 54ms
memory: 44296kb
input:
101140 1 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 1 2 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 1 1 1 2 2 2 2 1 2 1 2 2 2 1 2 1 2 1 2 2 1 1 1 1 2 1 2 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 1 2 1 1 1 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 2 2 1 1 1 2 2 2...
output:
5098687920
result:
ok single line: '5098687920'
Test #21:
score: 0
Accepted
time: 99ms
memory: 48560kb
input:
181968 2 1 2 1 2 2 1 2 2 2 1 1 1 1 2 1 2 2 1 1 2 2 2 2 1 1 1 1 1 2 1 1 2 2 2 2 1 2 1 2 2 1 2 1 2 2 2 1 2 2 2 1 1 2 1 2 1 2 2 2 1 1 2 2 1 2 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 1 2 2 2 2 1 2 1 1 1 2 1 2 1 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 2 1 2 1 1 2 2 1 2 1 1 2 1 1 1 1 2 1 2 1 1...
output:
16531060131
result:
ok single line: '16531060131'
Test #22:
score: 0
Accepted
time: 106ms
memory: 48884kb
input:
188622 2 2 1 2 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 1 1 2 2 2 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 1 2 1 2 2 1 2 1 1 1 1 2 1 1 1 1 1 2 2 2 2 1 1 2 1 2 1 1 1 1 2 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 1 1 1 1 2 1 1 2 2 1 1 2 1 2 2 1 1 1 1 1 1 1 1 2 2 1 2 2 2 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 1 1 2 1 2...
output:
17753612469
result:
ok single line: '17753612469'
Test #23:
score: 0
Accepted
time: 107ms
memory: 49448kb
input:
200000 2 1 2 1 2 1 2 2 2 1 2 2 1 1 1 2 1 1 2 1 2 2 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 1 1 2 1 2 1 1 1 2 2 2 2 1 2 2 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 2 2 1 2 2 1 1 2 1 2 2 1 2 2 2 2 1 2 2 2 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2 2 1 1 1 2 1 1 2 1 1 1 2 2 1 2 1 1 2 1 2 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2...
output:
19966666586
result:
ok single line: '19966666586'
Test #24:
score: 0
Accepted
time: 102ms
memory: 49276kb
input:
200000 2 2 1 2 2 1 2 2 1 2 2 2 2 2 2 1 1 1 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 2 2 2 1 2 1 2 2 2 1 1 2 1 2 1 2 1 1 2 2 2 1 2 2 1 2 2 1 1 2 1 2 1 1 1 2 1 2 2 1 1 1 2 1 2 2 1 2 2 2 1 1 1 2 2 1 2 1 1 1 2 1 1 1 2 1 1 2 2 1 2 1 2 1 2 2 1 2 2 2 1 1 2 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 2 2 1 2 2 2 1...
output:
19954274756
result:
ok single line: '19954274756'
Test #25:
score: 0
Accepted
time: 105ms
memory: 49444kb
input:
200000 1 2 1 2 2 2 2 1 1 1 2 1 2 2 2 1 2 1 2 1 1 1 2 2 1 2 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 2 1 1 1 2 1 2 2 2 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 1 2 2 1 1 1 2 2 2 2 2 1 2 2 1 2 1 1 2 1 2 1 2 2 1 1 2 2 2 2 1 2 2 1 2 2 2 1 2 1 1 2 2 1 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 1 1 1...
output:
19965178643
result:
ok single line: '19965178643'
Test #26:
score: 0
Accepted
time: 104ms
memory: 49628kb
input:
200000 1 1 1 2 1 1 1 2 2 2 2 1 2 1 2 1 1 2 1 1 2 2 2 2 2 2 1 1 1 2 1 1 2 2 2 1 1 2 2 1 2 2 1 1 2 2 2 2 2 2 2 1 1 1 2 1 1 1 2 1 1 2 1 1 1 1 2 2 2 2 1 1 1 1 1 2 1 2 1 2 1 2 2 2 1 2 1 2 1 1 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 2 2 1 1 2 2 2 2 1 1 2 1 2 1 2 1 2 1 1 1 2 2 1 1 2 2 1 2 2 2 1 1 2...
output:
19958231053
result:
ok single line: '19958231053'
Test #27:
score: 0
Accepted
time: 110ms
memory: 49628kb
input:
200000 2 1 2 2 2 2 2 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 1 2 1 2 1 2 2 1 2 2 1 1 1 1 2 2 2 2 1 1 2 1 2 2 2 1 2 1 2 2 2 1 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 2 1 1 1 2 1 1 1 2 1 2 1 1 1 1 2 1 1 1 2 2 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 2 2 1 1 2 1 2 1 2 1 2 2 1 2 2 2 2 1 2 1 2 2...
output:
19940557707
result:
ok single line: '19940557707'
Test #28:
score: 0
Accepted
time: 99ms
memory: 54208kb
input:
200000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
20000100000
result:
ok single line: '20000100000'
Subtask #4:
score: 70
Accepted
Test #29:
score: 70
Accepted
time: 109ms
memory: 54104kb
input:
200000 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369607912 369...
output:
20000100000
result:
ok single line: '20000100000'
Test #30:
score: 0
Accepted
time: 25ms
memory: 41588kb
input:
37917 129840 176878 13755 55849 35264 88754 89426 182279 136961 131304 156250 46358 113483 174785 195718 19737 81241 158521 131032 167400 107011 139868 148087 100924 79164 198764 59951 109390 2077 92823 131167 154791 7641 113974 125699 174425 91439 130834 2644 95533 115951 103246 131917 164113 48929...
output:
37920
result:
ok single line: '37920'
Test #31:
score: 0
Accepted
time: 82ms
memory: 44404kb
input:
76643 101198 57919 24942 151089 109275 154893 22618 124356 9697 195144 127677 31895 97245 147513 69933 199128 131842 97327 185147 40669 105128 84643 123903 120815 55309 76974 151846 14021 166403 164650 5188 154132 103916 14359 54364 150696 42100 97617 23660 171971 150702 84954 49052 88470 91856 1981...
output:
76646
result:
ok single line: '76646'
Test #32:
score: 0
Accepted
time: 204ms
memory: 53036kb
input:
188576 131331 187625 143833 122871 13128 50650 13948 62479 86060 77094 29339 77900 74700 61252 131966 193583 121065 51883 72022 48260 119581 34740 160511 135145 29465 131990 81640 132662 171593 39448 108629 116095 198033 123564 159428 39561 154414 19395 189517 26751 145308 175991 47935 26455 55315 1...
output:
188580
result:
ok single line: '188580'
Test #33:
score: 0
Accepted
time: 73ms
memory: 44776kb
input:
81677 151138 94725 136966 55265 48546 97793 86916 71136 77599 81529 37373 71839 17838 155223 105991 189123 130476 72055 82561 125944 105689 58785 141245 166783 35574 39767 132136 130006 15196 181538 177707 130364 128740 179124 90471 70000 178582 82436 92578 106505 104181 119432 140008 57381 85107 99...
output:
81680
result:
ok single line: '81680'
Test #34:
score: 0
Accepted
time: 84ms
memory: 45168kb
input:
85469 162973 101018 156095 81669 164501 65670 141292 180584 171992 91567 143747 167665 11099 74910 105715 105704 113614 199833 90661 1283 32737 70578 29599 19381 48817 19486 58603 166575 61762 152874 174648 87331 187124 135100 66436 111888 45535 79466 30402 97770 52748 119393 199193 55802 127964 187...
output:
85471
result:
ok single line: '85471'
Test #35:
score: 0
Accepted
time: 44ms
memory: 42808kb
input:
55436 118474 197488 160115 17136 84680 146238 73226 22042 9788 97847 39453 173749 185194 52298 26596 172650 166320 82807 164231 192402 156762 140472 181500 127318 111754 80304 58604 52614 120559 47 90797 83211 8281 131162 2360 15114 184261 33375 181775 190418 153451 192257 105878 195991 124898 19613...
output:
55442
result:
ok single line: '55442'
Test #36:
score: 0
Accepted
time: 32ms
memory: 41244kb
input:
33213 35774 156615 64014 171713 38840 146314 112723 18802 71940 164360 68510 146628 85796 26377 162402 162837 82104 86330 78431 68307 20923 41981 83292 114253 24092 178529 39414 164449 47399 114536 75728 150231 120797 2254 13373 123314 180432 149926 75192 49527 111209 199813 54562 49131 30903 165689...
output:
33216
result:
ok single line: '33216'
Test #37:
score: 0
Accepted
time: 29ms
memory: 41696kb
input:
40378 151549 27366 108793 109535 168695 126641 129353 4627 27277 179450 101017 152535 34742 73795 136233 90659 173850 1337 178257 55170 79065 173619 16471 101154 154325 134966 182749 168338 114885 29261 33259 50241 70641 37498 28197 182589 167286 53127 124790 97348 11164 171188 148217 82761 101671 4...
output:
40378
result:
ok single line: '40378'
Test #38:
score: 0
Accepted
time: 109ms
memory: 52448kb
input:
200000 3 3 1 4 5 5 3 2 4 1 1 1 1 5 1 3 4 2 5 1 4 2 1 5 5 1 5 3 1 2 3 5 2 3 4 2 5 5 1 4 1 4 3 1 5 1 1 3 1 5 4 3 3 3 1 1 5 3 4 1 4 4 2 5 1 3 2 4 1 3 3 4 4 2 1 1 1 1 3 4 5 3 4 2 1 1 1 3 4 3 1 4 4 2 5 5 5 4 1 3 5 1 2 1 1 2 1 4 4 4 2 3 1 1 4 1 1 4 4 1 3 4 1 4 3 1 1 5 2 4 3 2 3 2 1 5 4 4 2 2 1 5 3 4 5 2 2...
output:
553839
result:
ok single line: '553839'
Test #39:
score: 0
Accepted
time: 108ms
memory: 52372kb
input:
200000 3 3 1 2 2 1 3 3 5 3 1 2 2 1 1 3 4 5 5 4 2 2 5 4 5 4 3 2 4 5 3 5 1 1 5 3 3 2 1 3 2 4 4 3 2 3 4 2 5 3 5 5 2 2 3 3 2 5 2 3 3 3 4 1 5 5 3 1 4 1 2 1 1 3 5 1 2 3 2 5 4 1 5 4 5 4 4 3 4 3 4 4 2 1 1 1 4 4 2 5 3 3 4 5 1 5 2 2 2 4 2 1 1 2 1 1 4 1 4 2 1 1 5 3 4 3 5 2 3 2 3 4 4 1 1 2 4 5 5 1 4 2 3 3 1 1 4...
output:
555084
result:
ok single line: '555084'
Test #40:
score: 0
Accepted
time: 116ms
memory: 52080kb
input:
200000 5 1 2 2 3 2 2 2 2 5 4 3 4 2 1 2 1 5 3 3 5 3 2 5 3 1 3 4 3 4 5 5 2 1 1 5 2 4 1 2 4 1 2 4 5 2 4 5 3 1 4 4 3 2 3 4 5 4 1 4 5 4 4 2 2 4 5 3 3 4 1 3 5 3 5 5 4 3 2 5 3 3 2 3 3 1 4 3 1 4 1 5 2 1 2 5 4 3 4 4 4 3 1 4 1 1 2 3 2 4 1 2 1 3 4 1 4 5 1 3 5 2 2 2 3 1 3 4 3 3 4 1 3 2 2 5 4 4 5 1 1 1 1 3 3 4 3...
output:
549476
result:
ok single line: '549476'
Test #41:
score: 0
Accepted
time: 105ms
memory: 52388kb
input:
200000 2 1 2 1 2 3 5 1 2 3 5 3 1 2 4 3 4 3 5 4 2 4 1 2 4 3 4 3 4 1 1 1 1 1 3 5 5 4 4 1 4 4 5 4 1 4 4 2 5 3 3 4 3 3 1 4 1 5 4 2 3 4 4 3 5 5 3 5 2 1 3 5 5 2 2 3 1 5 3 3 5 4 1 3 3 1 2 5 3 5 1 4 1 3 2 4 5 1 5 1 2 1 2 1 1 1 5 4 2 3 1 2 5 3 3 3 4 4 1 3 3 2 2 2 4 5 3 5 4 3 5 3 4 1 2 2 5 1 4 2 5 4 4 3 3 2 5...
output:
553332
result:
ok single line: '553332'
Test #42:
score: 0
Accepted
time: 117ms
memory: 52060kb
input:
200000 1 1 4 1 3 3 1 1 3 2 2 2 3 1 4 4 5 5 5 3 4 4 5 3 4 1 1 1 3 5 5 2 3 5 3 3 4 5 1 2 5 2 4 3 4 1 2 2 5 5 2 3 1 1 4 5 4 5 3 2 4 5 1 3 3 3 1 1 2 2 3 2 2 4 5 3 3 1 3 1 2 4 4 2 1 5 3 3 2 1 4 5 1 5 4 3 5 1 1 1 2 4 3 2 2 5 4 2 5 3 3 3 5 4 4 2 1 2 4 2 2 5 1 1 2 1 5 1 2 3 2 2 3 4 1 5 1 5 3 5 4 2 1 3 2 3 2...
output:
557343
result:
ok single line: '557343'
Test #43:
score: 0
Accepted
time: 130ms
memory: 53500kb
input:
200000 999999994 999999994 1000000000 999999990 999999999 999999991 999999995 999999999 1000000000 999999999 999999991 999999998 999999990 1000000000 999999995 999999994 999999996 999999999 999999995 999999996 999999998 999999996 999999996 999999991 999999990 999999994 999999996 999999996 999999999 ...
output:
297992
result:
ok single line: '297992'
Test #44:
score: 0
Accepted
time: 142ms
memory: 53760kb
input:
200000 999999994 999999992 999999997 999999999 999999992 999999992 999999997 1000000000 999999995 999999998 1000000000 999999997 999999998 999999993 999999994 999999990 999999993 999999992 999999994 999999991 999999999 999999999 999999991 999999991 999999990 1000000000 999999995 999999990 999999993 ...
output:
298603
result:
ok single line: '298603'
Test #45:
score: 0
Accepted
time: 114ms
memory: 53564kb
input:
200000 1000000000 999999999 999999992 999999990 999999994 1000000000 1000000000 999999991 999999997 999999998 1000000000 999999997 999999998 999999997 999999994 999999997 999999999 1000000000 999999996 999999990 999999997 999999996 999999991 999999990 1000000000 999999995 999999997 999999991 1000000...
output:
299475
result:
ok single line: '299475'
Test #46:
score: 0
Accepted
time: 127ms
memory: 53648kb
input:
200000 999999990 999999991 999999996 999999995 999999998 1000000000 999999994 999999992 999999992 999999990 999999990 999999993 999999993 999999992 999999991 999999993 999999997 999999995 1000000000 999999990 999999993 999999998 999999992 999999994 999999991 999999995 1000000000 999999990 999999995 ...
output:
298159
result:
ok single line: '298159'
Test #47:
score: 0
Accepted
time: 140ms
memory: 53620kb
input:
200000 1000000000 999999992 999999997 999999990 999999992 999999992 999999997 999999991 999999996 999999993 999999995 999999999 999999991 999999996 999999990 999999991 999999991 999999995 999999999 999999999 999999995 999999990 999999990 999999994 999999998 999999995 999999995 999999997 999999998 10...
output:
298006
result:
ok single line: '298006'
Test #48:
score: 0
Accepted
time: 159ms
memory: 54792kb
input:
200000 43 171 80 40 219 172 32 106 60 135 196 98 197 208 140 218 184 130 154 161 4 65 38 117 120 116 193 186 34 83 168 27 40 53 192 23 36 81 198 193 120 146 222 150 92 223 54 185 4 162 37 63 71 126 27 219 182 172 45 131 111 69 128 109 199 81 162 61 59 209 170 57 218 193 49 188 153 41 140 76 149 143 ...
output:
203895
result:
ok single line: '203895'
Test #49:
score: 0
Accepted
time: 155ms
memory: 54772kb
input:
200000 210 175 59 42 213 145 64 173 134 93 61 29 137 222 208 116 125 110 219 113 73 212 52 46 35 74 48 88 38 25 70 173 105 118 112 102 51 85 70 116 33 72 92 83 184 154 66 65 116 146 221 120 73 195 177 150 8 155 48 73 51 96 52 105 132 96 63 157 70 170 155 177 9 189 127 96 9 107 105 83 183 131 167 10 ...
output:
203567
result:
ok single line: '203567'
Test #50:
score: 0
Accepted
time: 132ms
memory: 55104kb
input:
200000 15 67 2 10 75 28 29 65 74 9 87 68 35 75 45 63 79 36 19 10 22 21 20 47 7 24 15 78 86 2 45 11 36 50 39 63 58 63 70 79 88 13 19 8 16 31 16 16 20 52 12 46 26 73 18 25 14 31 69 26 37 57 31 10 41 53 72 28 68 10 36 50 15 75 80 1 9 89 42 68 13 29 49 24 85 18 63 52 1 5 9 18 13 67 13 50 80 48 2 57 40 4...
output:
209449
result:
ok single line: '209449'
Test #51:
score: 0
Accepted
time: 140ms
memory: 55200kb
input:
200000 74 86 89 47 7 51 54 86 85 21 37 34 36 61 12 69 62 4 71 24 41 18 89 80 35 58 10 51 70 40 29 14 51 21 81 5 68 64 89 25 30 34 54 4 65 45 80 45 28 34 29 86 84 2 11 46 48 25 86 44 85 80 73 14 85 29 27 65 42 76 5 79 79 18 41 11 9 57 64 48 31 21 28 56 22 75 66 17 26 63 75 7 22 13 11 71 48 26 89 88 7...
output:
209214
result:
ok single line: '209214'
Test #52:
score: 0
Accepted
time: 147ms
memory: 54540kb
input:
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
200000
result:
ok single line: '200000'
Test #53:
score: 0
Accepted
time: 141ms
memory: 54548kb
input:
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
200000
result:
ok single line: '200000'
Test #54:
score: 0
Accepted
time: 128ms
memory: 54564kb
input:
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
200000
result:
ok single line: '200000'
Extra Test:
score: 0
Extra Test Passed