QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#577715 | #9329. Good Subsegments | Afterlife# | AC ✓ | 38ms | 17328kb | C++20 | 1.4kb | 2024-09-20 14:13:09 | 2024-09-20 14:13:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=500050;
vector<int> c[N];
int las[N],now[N],n;
ll ans[N];
int t[N];
void calc(const vector<int> &a){
int mx=0,tot=0;
for(auto x:a){
mx=max(mx,x);
for(int i=2;i<=x;++i){
ans[i/2]+=x-i+1;
}
int now=tot;
for(int i=1;i<=x;++i){
ans[i]+=1LL*t[i]*(x-i+1);
now-=t[i];
ans[i]+=now;
}
for(int i=1;i<=x;++i){
++t[i];
++tot;
}
}
for(int i=0;i<=mx;++i){
t[i]=0;
}
}
void Solve(){
cin>>n;
for(int i=1;i<=n;++i){
now[i]=0;
las[i]=-1;
c[i].clear();
}
for(int i=1;i<=n+1;++i){
ans[i]=0;
}
for(int i=1;i<=n;++i){
int x;
cin>>x;
if(las[x]==i-1){
++now[x];
}
else{
if(now[x])c[x].push_back(now[x]);
now[x]=1;
}
las[x]=i;
}
for(int i=1;i<=n;++i){
if(now[i])c[i].push_back(now[i]);
}
for(int i=1;i<=n;++i){
calc(c[i]);
}
for(int i=n;i>=1;--i){
ans[i]+=ans[i+1];
}
for(int i=1;i<=n/2;++i){
cout<<ans[i]<<' ';
}
cout<<'\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin>>T;
while(T--)Solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 9696kb
input:
4 10 1 2 2 2 2 2 3 2 2 2 6 1 1 1 2 1 1 9 2 2 1 1 1 2 2 1 1 10 3 2 3 2 4 2 10 10 10 10
output:
28 11 3 0 0 10 2 0 16 3 0 0 10 1 0 0 0
result:
ok 17 numbers
Test #2:
score: 0
Accepted
time: 2ms
memory: 9848kb
input:
4 3 3 3 3 8 3 3 3 3 2 2 2 2 3 3 3 3 5 3 3 3 3 3
output:
3 12 2 0 0 3 10 3
result:
ok 8 numbers
Test #3:
score: 0
Accepted
time: 9ms
memory: 9704kb
input:
15430 4 4 4 2 2 9 1 1 1 1 1 1 1 1 2 10 2 2 2 2 2 2 4 4 4 3 7 4 4 4 4 4 4 4 7 6 6 6 6 5 5 5 6 6 6 6 6 6 6 8 8 8 8 8 5 5 3 3 7 7 7 7 7 6 6 6 10 4 4 4 4 2 2 2 2 2 2 4 1 2 2 2 6 1 1 1 1 1 1 10 6 6 6 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 7 1 3 3 3 3 3 3 10 4 4 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 10 10 10 10 10 1...
output:
2 0 28 15 6 1 18 6 1 0 0 21 10 3 9 1 0 15 6 1 8 1 0 0 9 1 0 21 7 1 0 0 3 0 15 6 1 24 10 3 0 0 36 21 10 3 15 6 1 29 15 6 1 0 21 10 3 16 4 0 0 0 13 2 0 0 0 3 0 13 2 0 0 0 7 1 0 6 0 0 3 6 1 10 3 0 36 21 10 3 10 3 0 10 3 10 3 3 45 28 15 6 1 6 1 11 3 0 6 1 7 0 0 6 1 15...
result:
ok 46132 numbers
Test #4:
score: 0
Accepted
time: 4ms
memory: 9768kb
input:
1785 33 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 63 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 73 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 2...
output:
528 465 406 351 300 253 210 171 136 105 78 55 36 21 10 3 1953 1830 1711 1596 1485 1378 1275 1176 1081 990 903 820 741 666 595 528 465 406 351 300 253 210 171 136 105 78 55 36 21 10 3 2628 2485 2346 2211 2080 1953 1830 1711 1596 1485 1378 1275 1176 1081 990 903 820 741 666 595 528 465 406 351 300 2...
result:
ok 49554 numbers
Test #5:
score: 0
Accepted
time: 4ms
memory: 9784kb
input:
1822 96 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 21 9...
output:
4560 4371 4186 4005 3828 3655 3486 3321 3160 3003 2850 2701 2556 2415 2278 2145 2016 1891 1770 1653 1540 1431 1326 1225 1128 1035 946 861 780 703 630 561 496 435 378 325 276 231 190 153 120 91 66 45 28 15 6 1 210 171 136 105 78 55 36 21 10 3 2178 1996 1822 1656 1498 1348 1206 1072 946 828 718 616 ...
result:
ok 49546 numbers
Test #6:
score: 0
Accepted
time: 6ms
memory: 9912kb
input:
2 89720 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 18749 1874...
output:
1848963231 1848783803 1848604391 1848424995 1848245615 1848066251 1847886903 1847707571 1847528255 1847348955 1847169671 1846990403 1846811151 1846631915 1846452695 1846273491 1846094303 1845915131 1845735975 1845556835 1845377711 1845198603 1845019511 1844840435 1844661375 1844482331 1844303303 184...
result:
ok 50000 numbers
Test #7:
score: 0
Accepted
time: 6ms
memory: 9912kb
input:
2 73829 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 44095 4409...
output:
535244835 535097201 534949599 534802029 534654491 534506985 534359511 534212069 534064659 533917281 533769935 533622621 533475339 533328089 533180871 533033685 532886531 532739409 532592319 532445261 532298235 532151241 532004279 531857349 531710451 531563585 531416751 531269949 531123179 530976441 ...
result:
ok 49999 numbers
Test #8:
score: 0
Accepted
time: 16ms
memory: 10140kb
input:
1 200000 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 128472 1284...
output:
9940180685 9939648679 9939116695 9938584733 9938052793 9937520875 9936988979 9936457105 9935925253 9935393423 9934861615 9934329829 9933798065 9933266323 9932734603 9932202905 9931671229 9931139575 9930607943 9930076333 9929544745 9929013179 9928481635 9927950113 9927418613 9926887135 9926355679 992...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 11ms
memory: 12056kb
input:
1 200000 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7540 7...
output:
4065333096 4064790840 4064248626 4063706454 4063164324 4062622236 4062080190 4061538186 4060996224 4060454304 4059912426 4059370590 4058828796 4058287044 4057745334 4057203666 4056662040 4056120456 4055578914 4055037414 4054495956 4053954540 4053413166 4052871834 4052330544 4051789296 4051248090 405...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 11ms
memory: 17328kb
input:
1 200000 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 60824 608...
output:
16266343 15555679 14864323 14192275 13539535 12906103 12291979 11697163 11121623 10565111 10027311 9507913 9006656 8523252 8057372 7608702 7179301 6768439 6375872 6002313 5646602 5307740 4984370 4676627 4383740 4105597 3841823 3592733 3356784 3134273 2924817 2727461 2542434 2368885 2206328 2054628 1...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 13ms
memory: 14044kb
input:
1 200000 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 78463 784...
output:
39558641 38833227 38115519 37405517 36703221 36008631 35321747 34642569 33971097 33307331 32651268 32002907 31362248 30729291 30104036 29486483 28876632 28274483 27680036 27093470 26514602 25943432 25379960 24824186 24276110 23735732 23203052 22678070 22160786 21651200 21149312 20655122 20168630 196...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 14ms
memory: 9704kb
input:
1332 102 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 ...
output:
5151 4950 4753 4560 4371 4186 4005 3828 3655 3486 3321 3160 3003 2850 2701 2556 2415 2278 2145 2016 1891 1770 1653 1540 1431 1326 1225 1128 1035 946 861 780 703 630 561 496 435 378 325 276 231 190 153 120 91 66 45 28 15 6 1 8515 8256 8001 7750 7503 7260 7021 6786 6555 6328 6105 5886 5671 5460 5253 ...
result:
ok 99670 numbers
Test #13:
score: 0
Accepted
time: 7ms
memory: 9796kb
input:
7544 17 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 29 28 28 28 28 28 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 12 6 6 6 6 6 6 6 6 6 6 6 6 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 9 1 1 1 1 1 1 1 1 1 25 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
136 105 78 55 36 21 10 3 286 234 190 153 120 91 66 45 28 15 6 1 0 0 66 45 28 15 6 1 120 91 66 45 28 15 6 1 36 21 10 3 200 156 120 91 66 45 28 15 6 1 0 0 136 105 78 55 36 21 10 3 332 265 207 157 115 81 55 36 21 10 3 0 0 0 0 0 0 0 0 666 595 528 465 406 351 300 253 210 171 136 105 78 55 36 21 1...
result:
ok 98130 numbers
Test #14:
score: 0
Accepted
time: 16ms
memory: 16256kb
input:
1 200000 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 78353 783...
output:
5320974 4790370 4296204 3840338 3421009 3035945 2683226 2361778 2070096 1806081 1568514 1355624 1166309 998669 851087 722263 611149 515783 434823 366543 309351 261814 222559 189828 162384 139160 118480 100186 84010 69846 57427 46669 37448 29652 23279 17999 13789 10343 7572 5429 3804 2553 1669 1018 6...
result:
ok 100000 numbers
Test #15:
score: 0
Accepted
time: 27ms
memory: 9792kb
input:
2222 117 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107...
output:
6786 6555 6328 6105 5886 5671 5460 5253 5050 4851 4656 4465 4278 4095 3916 3741 3570 3403 3240 3081 2926 2775 2628 2485 2346 2211 2080 1953 1830 1711 1596 1485 1378 1275 1176 1081 990 903 820 741 666 595 528 465 406 351 300 253 210 171 136 105 78 55 36 21 10 3 5253 5050 4851 4656 4465 4278 4095 391...
result:
ok 249439 numbers
Test #16:
score: 0
Accepted
time: 37ms
memory: 12784kb
input:
3 484349 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 13361 133...
output:
47109879008 47108910319 47107941642 47106972977 47106004324 47105035683 47104067054 47103098437 47102129832 47101161239 47100192658 47099224089 47098255532 47097286987 47096318454 47095349933 47094381424 47093412927 47092444442 47091475969 47090507508 47089539059 47088570622 47087602197 47086633784 ...
result:
ok 249999 numbers
Test #17:
score: 0
Accepted
time: 31ms
memory: 10740kb
input:
10 11592 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9313 9...
output:
14340873 14313577 14286315 14259087 14231893 14204733 14177607 14150515 14123457 14096433 14069443 14042487 14015565 13988677 13961823 13935003 13908217 13881465 13854747 13828063 13801413 13774797 13748215 13721667 13695153 13668673 13642227 13615815 13589437 13563093 13536783 13510507 13484265 134...
result:
ok 249997 numbers
Test #18:
score: 0
Accepted
time: 34ms
memory: 10336kb
input:
27 4664 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 3679 36...
output:
3545922 3534537 3523174 3511833 3500514 3489217 3477942 3466689 3455458 3444249 3433062 3421897 3410754 3399633 3388534 3377457 3366402 3355369 3344358 3333369 3322402 3311457 3300534 3289633 3278754 3267897 3257062 3246249 3235458 3224689 3213942 3203217 3192514 3181833 3171174 3160537 3149922 3139...
result:
ok 249991 numbers
Test #19:
score: 0
Accepted
time: 27ms
memory: 9768kb
input:
9073 47 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 46 46 46 46 46 46 46 89 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 5...
output:
801 713 633 561 496 435 378 325 276 231 190 153 120 91 66 45 28 15 6 1 0 0 0 3742 3570 3403 3240 3081 2926 2775 2628 2485 2346 2211 2080 1953 1830 1711 1596 1485 1378 1275 1176 1081 990 903 820 741 666 595 528 465 406 351 300 253 210 171 136 105 78 55 36 21 10 3 0 645 567 497 435 378 325 276 231 1...
result:
ok 247758 numbers
Test #20:
score: 0
Accepted
time: 32ms
memory: 9704kb
input:
5000 100 21 21 21 21 21 21 55 55 55 55 65 65 65 65 65 65 65 55 55 55 55 16 16 16 16 16 16 65 65 65 65 65 65 16 16 16 16 16 16 55 55 55 55 55 55 55 55 65 65 65 65 65 65 65 65 42 42 42 42 42 42 42 42 9 9 9 9 9 9 9 9 9 9 9 55 55 55 55 55 55 99 99 99 99 72 72 72 72 72 72 72 65 65 65 65 65 43 43 43 43 10...
output:
753 458 253 125 50 15 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 666 451 289 172 87 38 10 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 894 598 382 238 141 70 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 250000 numbers
Test #21:
score: 0
Accepted
time: 33ms
memory: 14500kb
input:
1 500000 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 459139 4591...
output:
124999250001 124997750011 124996250031 124994750061 124993250101 124991750151 124990250211 124988750281 124987250361 124985750451 124984250551 124982750661 124981250781 124979750911 124978251051 124976751201 124975251361 124973751531 124972251711 124970751901 124969252101 124967752311 124966252531 1...
result:
ok 250000 numbers
Test #22:
score: 0
Accepted
time: 26ms
memory: 14484kb
input:
1 500000 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 30518 305...
output:
124994750059 124988750263 124982750625 124976751141 124970751811 124964752635 124958753613 124952754745 124946756031 124940757471 124934759065 124928760813 124922762715 124916764771 124910766981 124904769345 124898771863 124892774535 124886777361 124880780341 124874783475 124868786763 124862790205 1...
result:
ok 250000 numbers
Test #23:
score: 0
Accepted
time: 35ms
memory: 13960kb
input:
1 500000 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 64115 641...
output:
124949755544 124898770603 124847796660 124796833221 124745880286 124694937852 124644005918 124593084484 124542173550 124491772108 124441380966 124391000124 124340629582 124290269340 124239919398 124189579756 124139250414 124088931372 124038622630 123988324188 123938036046 123887758204 123837490662 1...
result:
ok 250000 numbers
Test #24:
score: 0
Accepted
time: 34ms
memory: 14036kb
input:
1 500000 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 2 188540 188540 188540 188540 188540 188540 188540 188540 188540 2 188540 188540 188540 8 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 188540 5 188540 188540 188540 188...
output:
111673215384 99681820112 89024978071 79518653267 71014751817 63435752104 56671173222 50638627932 45246709207 40421955511 36105505456 32255339388 28818006238 25747144538 23011362235 20566078910 18377941129 16423397875 14680323025 13122346714 11729117375 10484461910 9368232881 8370618351 7478971029 66...
result:
ok 250000 numbers
Test #25:
score: 0
Accepted
time: 32ms
memory: 13968kb
input:
1 500000 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 128799 1287...
output:
124354668698 123712085938 123072740359 122436536950 121802970559 121172033468 120545191031 119922424112 119304202148 118689040712 118076442473 117466399876 116859872285 116257326877 115657302023 115059790230 114463827052 113871798664 113283210467 112697572853 112113927626 111531798758 110952599504 1...
result:
ok 250000 numbers
Test #26:
score: 0
Accepted
time: 33ms
memory: 14184kb
input:
1 500000 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 6 217692 217692 217692 217692 7 217692 217692 217692 217692 217692 217692 217692 217692 217692 217692 3 217692 217692 217692 1 217692 1 217692 217692 217692 217692 217692 217692 2...
output:
102460258706 83795835464 68594293522 56127253720 45923703508 37549993458 30687856560 25077188270 20492248620 16750517799 13690080910 11191006623 9150461242 7478111624 6104837519 4984530348 4069913683 3321354595 2712578341 2214086727 1806750031 1475509661 1204775970 983332618 802162309 654096536 5333...
result:
ok 250000 numbers
Test #27:
score: 0
Accepted
time: 34ms
memory: 14220kb
input:
1 500000 499346 5 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 499346 49...
output:
102467870809 83829819498 68640229189 56210374340 46022552779 37697570309 30886366253 25306811482 20732847603 16975481731 13888196023 11356025786 9283786865 7590920976 6210147526 5077413138 4148234646 3389919272 2769883490 2263666892 1848583354 1510202573 1232218721 1005536981 821215222 671458587 549...
result:
ok 250000 numbers
Test #28:
score: 0
Accepted
time: 38ms
memory: 14640kb
input:
1 500000 447530 447530 447530 447530 447530 447530 447530 2 447530 447530 447530 9 447530 447530 447530 447530 447530 447530 447530 447530 5 9 447530 6 447530 5 447530 1 447530 447530 447530 447530 447530 1 447530 10 447530 447530 447530 447530 447530 4 447530 447530 447530 447530 5 447530 1 5 44753...
output:
75478028362 44824006966 26842706489 16050525600 9625961890 5765449079 3454699814 2079649766 1249025282 749944766 449980193 270660408 163303955 98410818 59321700 35199323 20778245 12036648 7010633 4074240 2357976 1342653 746317 403870 216972 117986 63290 32699 16866 8655 4363 2482 1492 829 444 267 15...
result:
ok 250000 numbers
Test #29:
score: 0
Accepted
time: 33ms
memory: 13900kb
input:
1 500000 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264 2 5264 5264 5264 5264 5264 5264 5264 5264 5264 5264...
output:
122786138665 120614902339 118481534793 116386987414 114326902984 112299434988 110303730271 108345937724 106422287601 104527301816 102663842709 100834660686 99035720622 97265324909 95525760387 93814890112 92134077213 90485476533 88864409055 87273872553 85710950545 84177333798 82674235818 81198382850 ...
result:
ok 250000 numbers
Test #30:
score: 0
Accepted
time: 34ms
memory: 14088kb
input:
1 500000 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 493639 4 493639 493639 493639 1 493639 493639 ...
output:
107253171094 91907098687 78805578642 67557500317 57895644387 49608881627 42501542881 36400959541 31175487558 26689804819 22845988941 19546281897 16734437557 14321198110 12258541206 10491777428 8980377437 7682233621 6568442965 5617898655 4802769297 4107322159 3513191074 3005789832 2569745782 21941419...
result:
ok 250000 numbers
Test #31:
score: 0
Accepted
time: 29ms
memory: 14012kb
input:
1 500000 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 1 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 114878 4 114878 114878 114878 ...
output:
108794298629 94595350491 82281111836 71604210618 62307369479 54221689729 47170182313 41029709733 35684182608 31034386113 26995946822 23484450907 20421330341 17753360971 15428200761 13404666377 11645705127 10115815243 8791069597 7643227323 6640492921 5770595330 5011278250 4350720631 3776354651 328035...
result:
ok 250000 numbers
Test #32:
score: 0
Accepted
time: 25ms
memory: 10024kb
input:
50 10000 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1769 1...
output:
1873006 1847279 1821768 1796473 1771394 1746531 1721884 1697453 1673238 1649239 1625456 1601889 1578538 1555403 1532484 1509781 1487294 1465023 1442968 1421129 1399506 1378099 1356907 1335927 1315159 1294603 1274259 1254127 1234207 1214499 1195003 1175716 1156637 1137766 1119102 1100642 1082386 1064...
result:
ok 250000 numbers
Test #33:
score: 0
Accepted
time: 32ms
memory: 10084kb
input:
50 10000 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6655 6...
output:
1282654 1261500 1240556 1219822 1199298 1178984 1158880 1138986 1119302 1099828 1080564 1061510 1042666 1024032 1005608 987394 969390 951596 934009 916628 899453 882484 865721 849164 832813 816668 800729 784996 769469 754148 739033 724124 709418 694914 680612 666512 652614 638918 625424 612131 59903...
result:
ok 250000 numbers
Test #34:
score: 0
Accepted
time: 32ms
memory: 9980kb
input:
50 10000 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4352 4...
output:
5857679 5779532 5701975 5625008 5548631 5472844 5397647 5323040 5249023 5175596 5102759 5030512 4958855 4887787 4817304 4747403 4678084 4609347 4541192 4473618 4406618 4340185 4274318 4209017 4144282 4080113 4017631 3955697 3894573 3833991 3773945 3714435 3655457 3597004 3539072 3481660 3424768 3368...
result:
ok 250000 numbers
Test #35:
score: 0
Accepted
time: 35ms
memory: 9964kb
input:
10 22604 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 12024 120...
output:
255459106 255413901 255368700 255323503 255278310 255233121 255187936 255142755 255097578 255052405 255007236 254962071 254916910 254871753 254826600 254781451 254736306 254691165 254646028 254600895 254555766 254510641 254465520 254420403 254375290 254330181 254285076 254239975 254194878 254149785 ...
result:
ok 249998 numbers
Test #36:
score: 0
Accepted
time: 27ms
memory: 12604kb
input:
5 100000 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 53277 532...
output:
93449379 93249550 93049949 92850576 92651431 92452514 92253825 92055364 91857131 91659126 91461349 91263800 91066479 90869386 90672521 90475884 90279475 90083294 89887341 89691616 89496119 89300850 89105809 88910996 88716411 88522054 88327925 88134024 87940351 87746906 87553689 87360700 87167939 869...
result:
ok 250000 numbers
Test #37:
score: 0
Accepted
time: 35ms
memory: 10228kb
input:
10 80735 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9291 9...
output:
244950967 244778716 244606539 244434436 244262407 244090452 243918571 243746764 243575031 243403372 243231787 243060276 242888839 242717476 242546187 242374972 242203831 242032764 241861771 241690852 241520007 241349236 241178539 241007916 240837367 240666892 240496491 240326164 240155911 239985732 ...
result:
ok 249998 numbers
Test #38:
score: 0
Accepted
time: 35ms
memory: 9704kb
input:
50000 10 5 5 5 5 5 5 5 5 5 8 10 7 7 7 7 7 7 7 7 2 2 10 10 10 10 10 10 10 8 8 8 8 10 5 2 2 2 2 2 2 9 9 9 10 8 8 8 8 8 8 8 8 2 2 10 8 8 8 8 8 8 8 7 7 7 10 6 6 6 6 6 6 4 10 10 10 10 10 10 6 6 6 6 6 3 3 3 10 10 2 2 2 2 2 2 2 2 2 10 2 2 8 8 8 8 8 8 10 10 10 1 1 1 1 1 1 7 7 7 7 10 10 8 8 10 10 10 10 3 10 ...
output:
36 21 10 3 0 29 15 6 1 0 21 7 1 0 0 18 6 1 0 0 29 15 6 1 0 24 10 3 0 0 18 6 1 0 0 14 3 0 0 0 36 21 10 3 0 17 6 1 0 0 21 7 1 0 0 22 4 0 0 0 36 21 10 3 0 14 3 0 0 0 18 6 1 0 0 45 28 15 6 1 20 6 0 0 0 16 6 1 0 0 18 6 1 0 0 24 10 3 0 0 20 6 0 0 0 29 15 6 1 0 29 15 6 1 0 20 6 0 0 0...
result:
ok 250000 numbers
Test #39:
score: 0
Accepted
time: 30ms
memory: 9792kb
input:
5000 100 97 97 97 97 97 97 97 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 ...
output:
4029 3838 3658 3486 3321 3160 3003 2850 2701 2556 2415 2278 2145 2016 1891 1770 1653 1540 1431 1326 1225 1128 1035 946 861 780 703 630 561 496 435 378 325 276 231 190 153 120 91 66 45 28 15 6 1 0 0 0 0 0 1661 1470 1291 1124 969 826 695 576 469 374 291 220 161 114 79 55 36 21 10 3 0 0 0 0 0 0 0 0 0 ...
result:
ok 250000 numbers
Test #40:
score: 0
Accepted
time: 23ms
memory: 9828kb
input:
250 2000 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1815 1...
output:
1764625 1760631 1756645 1752667 1748697 1744735 1740781 1736835 1732897 1728967 1725045 1721131 1717225 1713327 1709437 1705555 1701681 1697815 1693957 1690107 1686265 1682431 1678605 1674787 1670977 1667175 1663381 1659595 1655817 1652047 1648285 1644531 1640785 1637047 1633317 1629595 1625881 1622...
result:
ok 250000 numbers
Test #41:
score: 0
Accepted
time: 27ms
memory: 9872kb
input:
2500 200 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 98 98 98 98 98 98 151 65 65 65 65 65 65 65 65 65 65 65 65 65 65 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 145 145 145 145 145 145 145 145 145 59 59 59 59 59 59 59 59 59 59 59 101 101 101 101 101 101 101 101 101 101 1...
output:
1609 1151 797 520 320 193 116 66 37 19 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2067 1585 1189 865 603 417 289 201 143 105 76 52 32 16 4 1 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 250000 numbers
Test #42:
score: 0
Accepted
time: 34ms
memory: 7832kb
input:
2500 200 124 124 124 169 169 169 169 169 169 148 148 148 180 180 180 180 180 180 180 160 160 160 160 160 160 160 160 129 129 129 129 169 169 169 169 169 169 92 92 92 92 92 92 92 92 92 92 163 163 163 163 163 163 163 163 115 115 115 115 115 115 115 115 115 115 52 52 52 52 52 52 52 52 70 70 150 150 150...
output:
1035 607 331 166 85 41 18 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 923 510 248 99 34 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 250000 numbers
Test #43:
score: 0
Accepted
time: 28ms
memory: 9916kb
input:
100 5000 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3183 3...
output:
695067 662249 630663 599954 570643 542301 515305 489102 464226 440457 417415 395092 374143 354005 334527 316081 298387 281297 264800 249041 234186 219869 206189 193035 180493 168655 157294 146593 136464 126849 117759 109273 101261 93745 86772 80113 73969 68201 62873 57847 53165 48938 44915 41087 374...
result:
ok 250000 numbers
Test #44:
score: 0
Accepted
time: 25ms
memory: 10096kb
input:
100 5000 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 4737 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1420 1...
output:
219138 207718 196787 186326 176238 166558 157235 148260 139632 131343 123389 115800 108536 101595 94972 88660 82654 76956 71544 66444 61619 57059 52757 48704 44891 41306 37946 34797 31929 29253 26767 24466 22343 20394 18609 16982 15495 14135 12894 11758 10723 9817 8999 8262 7628 7067 6573 6139 5757 ...
result:
ok 250000 numbers
Test #45:
score: 0
Accepted
time: 32ms
memory: 10072kb
input:
100 5000 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 4343 3002 3002 3002 3002 3002 3002 3002 3002 3002 3002 1985 1985 1985 1985 1985 1985 1...
output:
1262413 1097544 944583 803530 674385 557148 451722 357886 275399 203999 143440 96641 62241 37610 21195 10539 4742 1753 418 43 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 250000 numbers
Test #46:
score: 0
Accepted
time: 32ms
memory: 10048kb
input:
61 9954 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 7814 78...
output:
1065195 1019444 974875 931488 889283 848260 808419 769760 732283 695974 660816 626793 593903 562140 531491 501939 473468 446633 421039 396635 373655 351646 330519 310240 290852 272341 254611 237903 221939 206988 192995 179649 166949 155273 144317 134025 124273 115606 107393 99654 92348 85466 79023 7...
result:
ok 249985 numbers