QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#311853 | #1831. Bruteforce | CrayonIsGay | AC ✓ | 3825ms | 80552kb | C++23 | 7.9kb | 2024-01-22 21:23:41 | 2024-01-22 21:23:41 |
Judging History
answer
#include<bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,tune=native")
using namespace std;
// #define int long long
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
const ll N = 1e5+100;
const ll INF = (ll)1e18;
const ll MOD = 998244353;
inline ll read(){
ll ret=0,f=1;char ch=getchar();
while(!isdigit(ch)){
if(ch=='-') f*=-1;
ch=getchar();
}
while(isdigit(ch)){
ret=(ret<<3)+(ret<<1)+ch-'0';
ch=getchar();
}
return ret*f;
}
ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
ll kpow(ll a,ll b,ll mod){
ll ret=1,base=a%mod;while(b){if(b&1) ret=ret*base%mod;base=base*base%mod;b>>=1;}return ret;
}
inline ll upd(ll x){return (x%MOD+MOD)%MOD;}
ll C[10][10];
inline ll get_d(ll k,ll c,ll w){
return C[k][c]*kpow(w,k-c,MOD);
}
ll n,m,k,W,a[N];
const ll V = 1e5+2;
struct segment_tree0{
ll mod;
int cnt[N*4],sum[N*4],sum_k[6][N*4];
int tg[N*4];
segment_tree0(){memset(cnt,0,sizeof(cnt));memset(sum,0,sizeof(sum));memset(sum_k,0,sizeof(sum_k));memset(tg,0,sizeof(tg));}
inline void push_up(int rt){
sum[rt]=upd(sum[rt<<1]+sum[rt<<1|1]);
for(int i=0;i<=k;++i)
sum_k[i][rt]=upd(sum_k[i][rt<<1]+sum_k[i][rt<<1|1]);
cnt[rt]=cnt[rt<<1]+cnt[rt<<1|1];
}
inline void modify(int rt,int v){
tg[rt]+=v;
for(int i=k;i>=0;i--)
for(int j=i-1;j>=0;j--)
sum_k[i][rt]=upd(sum_k[i][rt]+1ll*sum_k[j][rt]*get_d(i,j,v));
sum[rt]=sum_k[k][rt];
}
inline void push_down(int rt){
if(tg[rt]!=0){
modify(rt<<1,tg[rt]);
modify(rt<<1|1,tg[rt]);
tg[rt]=0;
}
}
inline int query_sz(int rt,int l,int r,int idx){
if(r<=idx) return cnt[rt];
if(l>idx) return 0;
int mid=(l+r)>>1;
return query_sz(rt<<1,l,mid,idx)+query_sz(rt<<1|1,mid+1,r,idx);
}
inline void update_v(int rt,int l,int r,int w,int c){
if(r<w||l>w) return;
if(l==r){
if(c==1){
ll id=query_sz(1,0,V,w)+1;
cnt[rt]++;
for(ll i=0;i<=k;++i)
sum_k[i][rt]=upd(1ll*sum_k[i][rt]+1ll*w*kpow(id,i,MOD)%MOD);
}else{
ll id=query_sz(1,0,V,w);
cnt[rt]--;
for(ll i=0;i<=k;++i)
sum_k[i][rt]=upd(1ll*sum_k[i][rt]-1ll*w*kpow(id,i,MOD)%MOD);
}
sum[rt]=sum_k[k][rt];
return ;
}
int mid=l+r>>1;
push_down(rt);
update_v(rt<<1,l,mid,w,c);
update_v(rt<<1|1,mid+1,r,w,c);
push_up(rt);
}
inline void update_i(int rt,int l,int r,int ql,int qr,int v){
if(r<ql||l>qr) return;
if(ql<=l&&r<=qr){
if(v==1){
for(int i=k;i>=0;i--)
for(int j=i-1;j>=0;j--)
sum_k[i][rt]=upd(1ll*sum_k[i][rt]+1ll*sum_k[j][rt]*get_d(i,j,v));
}else{
for(int i=k;i>=0;i--)
for(int j=i-1;j>=0;j--)
sum_k[i][rt]=upd(1ll*sum_k[i][rt]+1ll*sum_k[j][rt]*get_d(i,j,v));
}
sum[rt]=sum_k[k][rt];
tg[rt]+=v;
return ;
}
int mid=(l+r)>>1;
push_down(rt);
update_i(rt<<1,l,mid,ql,qr,v);
update_i(rt<<1|1,mid+1,r,ql,qr,v);
push_up(rt);
}
}sg0;
ll kpw[20][20];
struct segment_tree1{
int cnt[N*4],sum[N*4],sum_k[6][6][N*4];
int tg[N*4];
segment_tree1(){memset(cnt,0,sizeof(cnt));memset(sum,0,sizeof(sum));memset(sum_k,0,sizeof(sum_k));memset(tg,0,sizeof(tg));}
inline void push_up(int rt){
sum[rt]=upd(sum[rt<<1]+sum[rt<<1|1]);
for(int i=0;i<W;++i)
for(int j=0;j<W;++j)
sum_k[i][j][rt]=upd(sum_k[i][j][rt<<1]+sum_k[i][j][rt<<1|1]);
cnt[rt]=cnt[rt<<1]+cnt[rt<<1|1];
}
inline void modify(int rt,int v){
v=(v%W+W)%W;
ll ret[6][6];
sum[rt]=0;
for(int j=0;j<W;++j){
for(int i=0;i<W;++i)
ret[j][i]=sum_k[j][(i-v+W*2)%W][rt];
for(int i=0;i<W;++i)
sum_k[j][i][rt]=ret[j][i];
for(int i=0;i<W;++i)
sum[rt]=upd(sum[rt]+1ll*j*kpw[i][k]%W*sum_k[j][i][rt]%MOD);
}
}
inline void push_down(int rt){
if(tg[rt]!=0){
tg[rt<<1]+=tg[rt];tg[rt<<1|1]+=tg[rt];
modify(rt<<1,tg[rt]);
modify(rt<<1|1,tg[rt]);
tg[rt]=0;
}
}
inline ll query_sz(int rt,int l,int r,int idx){
if(r<=idx) return cnt[rt];
if(l>idx) return 0;
int mid=(l+r)>>1;
return query_sz(rt<<1,l,mid,idx)+query_sz(rt<<1|1,mid+1,r,idx);
}
inline void update_v(int rt,int l,int r,int w,int c){
if(r<w||l>w) return;
if(l==r){
if(c==1){
ll id=query_sz(1,0,V,w)+1;
cnt[rt]++;
sum_k[w%W][id%W][rt]=upd(sum_k[w%W][id%W][rt]+1);
}else{
ll id=query_sz(1,0,V,w);
cnt[rt]--;
sum_k[w%W][id%W][rt]=upd(sum_k[w%W][id%W][rt]-1);
}
sum[rt]=0;
for(int j=0;j<W;++j)
for(int i=0;i<W;++i)
sum[rt]=upd(sum[rt]+1ll*j*kpw[i][k]%W*sum_k[j][i][rt]%MOD);
return ;
}
int mid=l+r>>1;
push_down(rt);
update_v(rt<<1,l,mid,w,c);
update_v(rt<<1|1,mid+1,r,w,c);
push_up(rt);
}
inline void update_i(int rt,int l,int r,int ql,int qr,int v){
if(r<ql||l>qr) return;
if(ql<=l&&r<=qr){
modify(rt,v);
tg[rt]+=v;
return ;
}
int mid=(l+r)>>1;
push_down(rt);
update_i(rt<<1,l,mid,ql,qr,v);
update_i(rt<<1|1,mid+1,r,ql,qr,v);
push_up(rt);
}
}sg1;
ll b[N];
void multi_test(){
for(int i=0;i<=6;++i){
C[i][0]=C[i][i]=1;
for(int j=1;j<i;++j)
C[i][j]=C[i-1][j-1]+C[i-1][j];
}
n=read(),k=read(),W=read();
for(int i=0;i<=10;++i)
for(int j=0;j<=10;++j)
kpw[i][j]=kpow(i,j,W);
sg0.mod=998244353;//sg1.mod=W;
for(int i=1;i<=n;++i){
a[i]=read();
b[i]=a[i];
}
sort(b+1,b+n+1);
for(int i=1;i<=n;++i){
sg0.update_v(1,0,V,b[i],1);
sg0.update_i(1,0,V,b[i]+1,V,1);
sg1.update_v(1,0,V,b[i],1);
sg1.update_i(1,0,V,b[i]+1,V,1);
}
// cout<<sg0.sum[1]<<endl;
// cout<<sg1.sum[1]<<endl<<endl;
ll q=read();
while(q--){
ll pos=read(),x=read();
sg0.update_v(1,0,V,a[pos],-1);
sg0.update_i(1,0,V,a[pos]+1,V,-1);
sg0.update_v(1,0,V,x,1);
sg0.update_i(1,0,V,x+1,V,1);
// cout<<sg0.sum[1]<<endl;
sg1.update_v(1,0,V,a[pos],-1);
sg1.update_i(1,0,V,a[pos]+1,V,-1);
sg1.update_v(1,0,V,x,1);
sg1.update_i(1,0,V,x+1,V,1);
// cout<<sg1.sum[1]<<endl<<endl;
assert(upd(sg0.sum_k[k][1])==upd(sg0.sum[1]));
printf("%lld\n",(ll)1ll*upd(sg0.sum_k[k][1]-sg1.sum[1])*kpow(W,MOD-2,MOD)%MOD);
a[pos]=x;
}
return ;
}
/*
Things to notice:
1. do not calculate useless values
2. do not use similar names
Things to check:
1. submit the correct file
2. time (it is log^2 or log)
3. memory
4. prove your naive thoughts
5. long long
6. corner case like n=0,1,inf or n=m
7. fileio in some oi-contest
8. module on time
9. the number of a same divisor in a math problem
10. multi-information and queries
*/
signed main(){
// freopen("data.in","r",stdin);
// freopen("my.out","w",stdout);
ll T=1;
while(T--) multi_test();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 78856kb
input:
3 1 1 2 2 8 2 2 5 3 6
output:
36 30
result:
ok 2 number(s): "36 30"
Test #2:
score: 0
Accepted
time: 3ms
memory: 78856kb
input:
4 2 2 1 3 3 7 4 1 1 2 4 3 8 4 8
output:
75 80 103 108
result:
ok 4 number(s): "75 80 103 108"
Test #3:
score: 0
Accepted
time: 4ms
memory: 78996kb
input:
10 1 1 16251 28898 58179 69362 48663 81443 34949 87167 16552 58931 10 6 89124 8 27159 4 7332 1 15852 9 67405 7 19413 10 97472 7 31114 6 31847 5 43794
output:
3511390 3107346 2780002 2779204 3079414 3018965 3365708 3406982 2970195 2936112
result:
ok 10 numbers
Test #4:
score: 0
Accepted
time: 3ms
memory: 79000kb
input:
100 2 2 44625 87890 57662 73552 89172 64466 22834 24089 60132 5187 88984 19022 67559 53954 42114 19018 80035 3367 50518 15479 72359 15452 38886 5945 34974 86214 16805 71388 48981 45377 34170 61384 88881 29453 94738 94669 56746 80508 79155 94505 82745 38134 41769 2032 23186 5636 39727 54400 86133 497...
output:
81216962 152846115 156547587 163221145 293598979 178882623 92185541 202208317 181562234 200670345 213033267 262881364 247600647 301317991 271334928 261885869 261690216 247578015 236998290 291971331 293746018 424418987 402413699 300515771 300819876 344295103 391424353 392633865 361623113 355154190 47...
result:
ok 100 numbers
Test #5:
score: 0
Accepted
time: 46ms
memory: 78940kb
input:
1000 5 5 67444 21858 17070 50937 22108 62205 2999 96284 84111 16255 69173 11611 84406 28349 95817 86160 87289 19642 22706 44359 31899 36187 15946 86429 23120 65928 81187 32204 37790 18497 52182 23455 59579 78480 45277 57706 60123 99315 19014 72404 35420 14632 12210 38628 1729 18606 23941 96652 80784...
output:
448982964 318631979 90368327 811603500 536477662 692557229 62990700 201293231 656272078 39300199 904902483 682330227 415437174 172036954 307435785 263728224 240392540 817310695 279181829 609019128 744046644 313110033 146349180 684606480 105663106 927540631 395442598 940076193 928045549 210861570 871...
result:
ok 1000 numbers
Test #6:
score: 0
Accepted
time: 46ms
memory: 79084kb
input:
1000 4 5 72227 53523 60356 75354 48348 59071 85117 86260 35140 27149 26706 84967 71598 76061 81453 53989 15316 82420 50695 46478 47536 10211 47703 57753 52396 25234 7015 28545 88953 3038 68077 40104 83546 75660 4206 97850 46721 49986 69628 79532 47269 93027 73722 38823 81502 9110 29754 24 19161 1699...
output:
188781625 762228616 136821592 674574163 347192262 485485871 629723820 280908647 588412565 725358221 863705098 659938578 242816623 893332458 843594911 548347865 837091341 189528539 686788524 27959019 161387564 209458902 58082579 541157908 634716980 370997719 711719499 222851922 266533026 468008815 12...
result:
ok 1000 numbers
Test #7:
score: 0
Accepted
time: 24ms
memory: 78860kb
input:
1000 5 5 934 216 913 239 824 359 107 658 672 201 259 787 699 375 495 399 957 273 386 716 148 563 663 746 673 466 938 833 871 307 932 330 175 572 438 641 106 574 148 265 235 48 284 823 142 616 664 401 301 156 36 155 455 46 314 386 80 918 9 283 960 228 576 322 866 871 642 571 93 364 384 343 780 740 29...
output:
863298675 561844282 707253518 131162317 733366001 240959848 491331485 945999426 884095393 601677031 988828395 989129097 271230712 188285368 526283575 610318634 640662356 513566498 530541446 619910493 101188507 650095342 264873841 559625254 219249144 536317513 208763693 184423450 658893967 186389056 ...
result:
ok 1000 numbers
Test #8:
score: 0
Accepted
time: 2444ms
memory: 80432kb
input:
100000 5 5 80 589 96 690 525 951 787 896 916 752 55 923 620 300 287 174 450 222 758 283 713 795 782 655 93 795 249 236 692 545 438 356 63 139 441 943 871 187 810 563 634 234 148 160 911 114 487 521 180 416 657 301 35 67 122 338 190 673 630 712 719 216 976 883 51 651 936 531 679 580 804 173 456 815 7...
output:
334846524 735139360 175630055 575968 183966896 545113566 393807292 242141610 253214633 590769329 859345957 37074142 11644872 268286727 70669491 935138232 773027517 769815377 968622436 886520151 263649182 106276038 489295947 665611891 959073798 994348948 331398630 959671469 2420615 919397617 90918278...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 1900ms
memory: 80484kb
input:
100000 5 4 735 435 80 695 784 93 11 865 335 20 38 402 773 258 99 158 444 457 625 882 216 925 98 483 616 528 959 0 52 564 854 511 400 747 889 831 691 854 527 835 513 579 395 761 400 120 244 831 927 679 161 296 736 566 818 682 210 868 931 499 189 288 621 883 748 530 56 809 265 407 590 742 256 487 678 ...
output:
548719996 71520431 568505663 379161284 6097684 102114391 354237340 868665986 14614795 86649147 537310476 422461024 11275154 172576801 425193845 682825227 982196723 672284562 176302530 249023719 594349424 313782752 346527432 52872850 806313812 568528655 609517066 700177790 315782379 352365845 1238981...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 2026ms
memory: 80460kb
input:
100000 2 5 758 521 465 830 421 463 283 166 133 343 524 932 209 754 696 510 884 405 438 529 254 956 708 87 968 3 881 303 530 201 477 8 591 779 976 941 513 777 494 5 650 581 137 524 821 887 972 798 819 161 60 530 267 478 650 473 332 818 564 101 942 139 803 603 465 834 493 103 993 108 439 656 663 354 8...
output:
712639554 393654980 316838492 263825807 136508419 293079232 664358103 882923327 615776339 523830723 175067835 871540343 242950115 425248987 107408844 790371295 846991468 545133566 139624573 717587699 841009747 264863714 127306668 672772119 580191505 135755622 25168918 381363267 803559279 748670082 6...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 610ms
memory: 80476kb
input:
100000 1 1 98857 95450 8761 8796 32999 3204 79376 59224 19559 86488 68166 79967 76372 45422 83775 69578 58742 16508 54518 83245 5805 23814 18798 8227 61098 48767 97853 33191 19557 69963 29437 93036 23844 57618 30455 47769 22611 35732 15543 8494 53219 98312 11271 8110 18323 25627 57458 52679 39948 98...
output:
633154338 636622836 869110043 944433203 26292304 292593133 455928943 414399154 936030502 188479648 844113652 224585412 558483626 84151965 80908493 139036313 679052093 795203204 283093047 131819539 765516059 739646846 733505844 686615161 526037275 211361490 918731957 369405351 992162334 434865397 628...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 604ms
memory: 80492kb
input:
99999 1 1 84065 42262 27834 45725 48637 31550 15847 16421 33522 69324 32467 67705 78088 57858 1232 58785 85059 81046 51845 22082 92835 18192 77117 41496 15310 90028 40341 97334 70203 40659 82713 52665 66991 87916 23236 68538 55464 23782 10126 31794 74268 32587 56047 63979 42426 17303 14729 78839 154...
output:
397605418 434616157 823909975 565762796 363009037 732697322 45977410 384301082 858494385 593806914 598694556 493401662 545774576 41438099 498970427 527315897 48543863 983804286 817499498 847078744 66145556 581010455 73968162 315694722 613721107 908935940 508741624 638653279 805323567 412440873 28203...
result:
ok 99999 numbers
Test #13:
score: 0
Accepted
time: 610ms
memory: 80492kb
input:
99998 1 1 66497 20934 49401 6641 81597 50032 22535 14211 48787 7234 49610 88323 62743 51313 22922 18740 1090 22200 2467 98431 66884 39352 21385 93946 30365 44817 17582 22511 75985 73746 91117 40922 88768 10270 66119 66602 68350 4737 41275 44099 30339 41923 59021 46112 89788 2469 30420 92995 2394 799...
output:
429126013 980722379 460930023 166203244 967108788 470570448 826212807 339565489 357806132 148831359 157799806 889023490 967136028 950382414 790580516 836485835 363603498 387102410 539326091 85671010 544154047 760145992 120003312 337753754 387108408 165508389 775459509 397605184 245724737 854023992 1...
result:
ok 99998 numbers
Test #14:
score: 0
Accepted
time: 2949ms
memory: 80500kb
input:
100000 1 5 87230 25309 34484 38597 7960 28393 45862 72885 14947 25425 13909 27410 36869 66390 40023 64195 99744 33207 65550 91648 5582 62857 69402 88182 99994 31516 27389 64639 89329 6424 27160 21617 57363 46166 78835 8367 84274 75912 67378 53833 14893 52240 60475 71870 35374 76597 41138 41222 69872...
output:
357884965 217786682 301529287 157905722 674367245 518995977 513076427 760143410 536098157 549473484 962488583 264042775 601960167 590709250 877976521 845342408 230698705 625770556 669568853 74312677 588384284 12257332 970643470 237213851 754118677 662033154 111099189 672529728 754533963 792787944 81...
result:
ok 100000 numbers
Test #15:
score: 0
Accepted
time: 1422ms
memory: 80552kb
input:
100000 5 1 39311 44443 73420 43258 38879 4845 7938 69802 91096 2500 91898 26955 19322 46295 30334 22610 30621 94920 86086 99120 97672 49449 5224 42107 84410 76300 11097 26587 44423 7453 55512 37332 8802 44550 27366 92366 98006 16977 7364 85156 37901 36039 49161 58637 99235 60999 80344 34014 37744 64...
output:
308466029 422687654 342887347 430217886 579914043 236611824 311197824 852552835 132493869 198188509 139253883 31526889 751585721 880163452 662347929 228455250 194768262 986227206 428752423 584606131 87632134 633476423 615369650 37452216 584481846 365792837 212571253 506754400 193431794 19156047 7440...
result:
ok 100000 numbers
Test #16:
score: 0
Accepted
time: 1145ms
memory: 80476kb
input:
100000 4 1 8853 76108 27599 27263 16425 12605 79161 24537 42125 13394 49431 59899 30861 94007 15971 66092 23407 92938 65381 76891 78069 74780 47875 13431 13684 35606 52993 63341 95587 91995 11820 53982 57116 41730 26707 32510 49363 43303 57979 92284 60644 38780 86326 83179 79007 27156 75262 77800 76...
output:
681130756 679718773 140487015 35030412 867183295 239368710 970287626 101864396 961831043 805534777 192104270 582014193 941139014 926047208 335230371 973678409 481124479 660600717 144468289 146673804 587242452 928059615 839275279 710092403 593989168 78480728 135433681 92620036 282453816 276794421 583...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 1437ms
memory: 80488kb
input:
99999 5 1 24519 56015 92493 80188 89758 44085 9169 62241 5058 85337 56200 39040 45385 93972 12551 87470 56937 83804 94306 37957 84701 79067 74437 99724 27728 41907 4892 15076 8522 13390 8787 7856 76296 34435 95801 13134 30858 40269 1948 8455 18536 70315 93938 14504 12444 28327 37615 60175 13202 8161...
output:
319751930 97649044 54835938 973021342 761503115 500979598 841417871 426564758 666632020 103301321 328145085 64485798 10708281 502475703 306119588 805443178 507182921 125419260 456524757 301562238 520000704 923507591 646265891 513297897 962292543 895969841 452183144 819159630 510173188 217870907 5120...
result:
ok 99999 numbers
Test #18:
score: 0
Accepted
time: 740ms
memory: 80416kb
input:
99999 2 1 79282 99704 8895 61721 71091 34684 68972 61687 82493 58430 64040 34761 90896 85800 39942 90957 67926 18268 83444 44311 12437 3754 45360 29760 50794 95481 63206 36233 83799 56119 2057 46910 43024 15082 64307 93154 68866 8351 24272 319 75872 54192 94537 39437 62654 51146 19811 35053 52682 88...
output:
719278239 407475527 162392493 488320952 340123969 882519334 634782536 687612516 866258291 248429908 169102535 117445594 906494139 578270330 905771535 834981845 880414086 945920013 539692538 162516563 172870243 919621251 729696560 431510134 917187297 14205340 419684826 587964732 235425729 151865725 4...
result:
ok 99999 numbers
Test #19:
score: 0
Accepted
time: 1739ms
memory: 80492kb
input:
100000 3 3 57824 42909 53952 84202 61246 54446 89074 76791 97575 69410 90730 1529 90270 31996 85179 85370 20629 64063 51471 53416 21833 35947 37313 82765 62408 53908 44896 45613 66876 24559 85890 29475 15462 95358 65274 38193 91140 8618 81925 1874 94018 18486 4817 53080 34925 39004 10740 25444 86188...
output:
877793669 597617972 965039589 634699677 20843741 507668583 354282060 9787583 770900207 932352048 907390950 729468157 25626937 12416167 652922418 850376161 188598864 47449440 663321615 99244589 194070991 69546466 742259902 629313370 747235426 932747230 49530288 181781047 670716039 286490210 678702951...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 1126ms
memory: 80476kb
input:
99999 2 2 13548 52512 70636 40154 10175 12617 90903 30652 60357 43164 26129 66313 59383 36385 22140 4507 48382 42649 93595 44995 36089 29705 99854 85492 98345 4771 8416 83339 18209 50337 4211 14158 30420 68959 41952 1576 22108 35879 18970 33931 39220 62881 20441 36463 45280 3785 58991 59775 14179 17...
output:
379725511 332321789 310401411 287631106 486511269 50147836 12807987 393590258 856821308 807273250 557245638 195345554 714879177 27158882 766955126 395276525 373693209 953088757 788387938 541002807 428834547 610884543 561044371 14200492 625866197 573506975 816526951 527888322 198723124 854050518 5391...
result:
ok 99999 numbers
Test #21:
score: 0
Accepted
time: 1754ms
memory: 80468kb
input:
99999 3 3 43032 14068 73025 34584 12125 82792 25545 33988 11537 52246 55032 64920 16331 4018 2636 25882 46946 52947 24450 27494 44103 30324 6524 16034 40967 19515 87386 9755 6628 95256 90471 99999 93850 50002 9361 58962 48339 7562 76508 60415 39412 28415 49594 98055 72481 65920 43665 51605 61646 862...
output:
253359352 427454749 994160847 823182121 372353696 241593085 766063423 182137259 297165517 814961745 73606344 679081015 59253730 545419649 314105279 607887197 947196752 480771833 975449240 98160028 78079758 703344709 258990257 908808120 785842845 374986311 878957941 841040236 433556933 731184579 3942...
result:
ok 99999 numbers
Test #22:
score: 0
Accepted
time: 3806ms
memory: 80404kb
input:
99999 5 5 37239 74981 58628 34336 99961 9686 2 75902 65207 24274 12836 86483 19335 50180 44454 6433 97939 76156 56644 97667 19718 93763 25039 79679 42277 49003 99189 46524 78294 38957 46922 12091 20708 22982 44180 73733 5973 80448 53783 53795 4557 89003 43140 43023 89083 38883 32189 37824 43126 6579...
output:
44420510 197681809 807844885 238061876 854187796 339498069 59226732 709234765 501798940 299417621 323212455 568374032 997057322 414278089 350126842 682717872 120490766 568566001 535991176 553592379 237261843 659706180 517426182 409507595 145951830 244244066 590982580 182777575 775456452 325702210 24...
result:
ok 99999 numbers
Test #23:
score: 0
Accepted
time: 3492ms
memory: 80428kb
input:
99999 4 5 42022 17540 12806 18340 77507 6552 46878 65877 16236 35168 46023 59839 66115 22238 30090 74262 50313 74173 49392 24131 75769 43441 56796 26655 95899 8310 76324 83278 64698 23498 62818 28741 44675 84923 19175 13876 92572 31120 63985 96164 2953 67397 80305 43218 68855 69800 2760 16850 81504 ...
output:
601441213 401014565 904319509 236433098 361663359 256059728 516267322 601963521 275957530 636091101 561875102 982518 782885054 191497798 377140785 649282449 777277976 942095839 973854191 936962083 178924583 913956171 257900985 799425659 361652144 676832069 212781991 144215654 90215555 779216558 2648...
result:
ok 99999 numbers
Test #24:
score: 0
Accepted
time: 3825ms
memory: 80472kb
input:
100000 5 5 27684 14715 74795 73060 49081 81341 63531 18703 51244 41438 48535 74399 93273 2503 51342 17226 71622 35965 48423 58829 97449 64145 55827 97716 88065 59049 91941 47140 38542 43914 93648 76809 42321 33098 16158 77311 73121 92398 83546 30495 59162 89968 98365 22395 64979 11967 64024 87317 67...
output:
487075012 306381366 366634728 735897644 634249821 268727232 203430391 161867005 246468076 437266393 690002551 305328900 615326200 48104571 210492025 776271183 141760666 178758238 199675479 44273256 222466958 820430457 330546336 78496912 77209138 787821426 195140148 568950241 441547066 598917600 9747...
result:
ok 100000 numbers
Test #25:
score: 0
Accepted
time: 3499ms
memory: 80432kb
input:
99998 4 5 24454 20559 58720 79257 99573 84622 53566 63667 31501 48732 98406 91352 91183 56106 16539 69459 90692 39675 14 35720 74165 64601 65824 54758 21848 38753 77913 73215 46132 21344 35982 41345 90799 42518 45992 95875 29803 87729 70786 73228 94265 1079 7625 60593 16215 30620 42798 55353 92839 1...
output:
663762514 417299869 205272168 877708609 803989215 476676817 981458605 442920138 400107437 15708174 255427394 453920533 704184371 298754505 354547726 602534923 80381019 701009826 609736864 348919080 268150965 645447187 710937243 51036068 282092946 107112851 902993856 716697141 162990715 814260575 809...
result:
ok 99998 numbers