QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23584#3264. 相逢是问候Qingyu97 425ms27248kbC++203.3kb2022-03-17 22:25:572022-04-30 03:35:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 03:35:53]
  • 评测
  • 测评结果:97
  • 用时:425ms
  • 内存:27248kb
  • [2022-03-17 22:25:57]
  • 提交

answer

// From Luogu: https://www.luogu.com.cn/blog/_post/89884
#include<cmath>
#include<cctype>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>

#define M 55
#define maxn 100005

using namespace std;

typedef unsigned long long LL;

template<typename T> inline void read(T &x){
    x=0; char c=getchar();
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
}

int n,m,mint,ls[maxn],rs[maxn],ti[maxn],cnt;

LL p,c,pow1[maxn][M],pow2[maxn][M],v[maxn],val[maxn],phi[M];

bool flag,b1[maxn][M],b2[maxn][M];

inline LL calc_phi(LL vi){
    LL ret=vi,tmp=vi,lim=sqrt(vi);
    for(LL i=2;i<=lim;++i){
        if(!(tmp%i)){
            ret=ret*(i-1)/i;
            while(!(tmp%i)) tmp/=i;
        }
    }
    if(tmp>1) ret=ret*(tmp-1)/tmp;
    return ret;
}

inline void pre_work(){
    LL tmp=p; phi[0]=p;
    while(tmp!=1) tmp=calc_phi(tmp),phi[++mint]=tmp;
    phi[++mint]=1;
    for(int i=0;i<=mint;++i){
        pow1[0][i]=1;
        for(int j=1;j<=10000;++j){
            pow1[j][i]=pow1[j-1][i]*c;
            if(pow1[j][i]>=phi[i]) pow1[j][i]%=phi[i],b1[j][i]=1;
            b1[j][i]|=b1[j-1][i];
        }
    }
    for(int i=0;i<=mint;++i){
        pow2[0][i]=1;
        b2[1][i]=b1[10000][i];
        for(int j=1;j<=10000;++j){
            pow2[j][i]=pow2[j-1][i]*pow1[10000][i];
            if(pow2[j][i]>=phi[i]) pow2[j][i]%=phi[i],b2[j][i]=1;
            b2[j][i]|=b2[j-1][i];
        }
    }
}

inline LL calc(LL v,LL id){
    flag=0;
    LL v1=v%10000,v2=v/10000,ret=pow1[v1][id]*pow2[v2][id];
    if(ret>=phi[id]) ret=ret%phi[id],flag=1;
    flag|=b1[v1][id]|b2[v2][id];
    return ret;
}

inline LL dfs(LL vi,int deep,int lim){
    flag=0;
    if(deep==lim){
        if(vi>=phi[deep]) flag=1,vi%=phi[deep];
        return vi;
    }
    LL ci=dfs(vi,deep+1,lim);
    return calc(flag?ci+phi[deep+1]:ci,deep);
}

inline void build(int L,int R,int cur){
    if(L==R){ read(v[cur]); val[cur]=v[cur]; return ; }
    int mid=(L+R)>>1;
    ls[cur]=++cnt; build(L,mid,ls[cur]);
    rs[cur]=++cnt; build(mid+1,R,rs[cur]);
    val[cur]=val[ls[cur]]+val[rs[cur]];
    if(val[cur]>=p) val[cur]-=p;
}

inline void update(int L,int R,int l,int r,int cur){
    if(ti[cur]>=mint) return ;
    if(L==R){
        ++ti[cur]; val[cur]=dfs(v[cur],0,ti[cur]);
        return ;
    }
    int mid=(L+R)>>1;
    if((l<=mid)&&(ti[ls[cur]]<mint)) update(L,mid,l,r,ls[cur]);
    if((r>mid)&&(ti[rs[cur]]<mint)) update(mid+1,R,l,r,rs[cur]);
    val[cur]=val[ls[cur]]+val[rs[cur]];
    if(val[cur]>=p) val[cur]-=p;
    ti[cur]=min(ti[ls[cur]],ti[rs[cur]]);
}

inline LL query(int L,int R,int l,int r,int cur){
    if((l<=L)&&(R<=r)) return val[cur];
    int mid=(L+R)>>1; LL ret=0;
    if(l<=mid) ret=query(L,mid,l,r,ls[cur]);
    if(r>mid) ret+=query(mid+1,R,l,r,rs[cur]);
    return (ret>=p)?(ret-p):ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    read(n); read(m); read(p); read(c);
    build(1,n,++cnt); pre_work();
    while(m--){
        int opt,l,r;
        read(opt); read(l); read(r);
        if(opt==0) update(1,n,l,r,1);
        else if(opt==1) cout<<query(1,n,l,r,1)<<endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 5
Accepted
time: 166ms
memory: 21212kb

input:

45584 41916 59814720 51285695
45912706 10630744 27740926 16458675 35721023 54916324 21588702 8075160 8644669 2651528 8548247 13918903 38922864 22389520 13561070 28812648 41064507 39553490 55456972 25606040 1843348 10221258 11520360 31233313 27630240 52329802 40048051 29301841 12171226 14518046 19562...

output:

42362247
34868238
34315005
12103369
15434060
5228225
18448303
22390504
33380417
26083485
15787123
47149364
40022195
4269481
57803029
5040636
45866852
18707692
27779046
47083187
32812873
19965867
40284855
34206553
46329883
24861319
59329109
50032126
6466299
18029829
37085526
1619053
33586367
3043363
...

result:

ok 41916 lines

Test #2:

score: 5
Accepted
time: 30ms
memory: 22808kb

input:

22995 22376 2544509 416331
1176594 1050747 1875958 2397774 379394 352061 1063481 39898 840406 2176353 190864 163298 1818339 1586740 1589287 1805147 2426624 2056738 304774 203687 1306667 1261985 26621 1166780 1297450 2540811 2360217 697857 2307111 2092547 1808769 184066 1751678 2372887 815653 1557313...

output:

2038157
2459643
380272
244963
1669682
2540880
1937911
899415
1526195
249988
358332
1549043
566322
1904122
1047076
210615
247553
1370120
1083831
143663
2180347
1072062
936539
1352880
262012
177922
2435486
414937
2056937
1205429
284829
2102085
2044451
2444889
827921
2311776
1904272
1335586
274956
1872...

result:

ok 22376 lines

Test #3:

score: 5
Accepted
time: 178ms
memory: 23824kb

input:

49866 46473 56351508 7624655
26761759 16685195 55970128 16849112 1591188 42969608 7299159 41900772 51513027 25996444 21686031 33143134 30769105 35951652 7642651 36244222 38488869 14612492 10678690 34699745 46605564 27012335 52091910 49266524 23510586 1806815 5557244 10595252 39998591 43026071 843769...

output:

24708106
49151898
37447145
10821312
1429326
10092267
42589995
8537888
4847313
8669195
46226546
49320404
22292310
7823653
41400148
8952832
24748623
12100820
26295307
29809453
39968857
1026949
13845284
42082916
50684751
13748882
23846862
28904176
39067940
48151884
13559439
6158681
16761197
10707165
22...

result:

ok 23253 lines

Test #4:

score: 5
Accepted
time: 28ms
memory: 22544kb

input:

21786 21359 9172957 5296419
7344030 5194814 775869 1485494 4118440 6062259 3345556 578443 4642879 1731073 7992559 2411206 4169048 2849184 7875222 5529115 6204495 6418145 8739485 5558460 581172 2313584 7235660 1581717 3540440 4821894 7176896 8246335 375392 1519824 8295840 4499362 463386 1646513 37253...

output:

8775264
2989682
4463342
7511423
4799896
6203385
3169563
3859629
700030
8959497
8776023
1291201
1354390
6437951
1101343
2810797
1612630
59734
2000776
7838070
5558357
3488654
2208790
2092777
7842331
8493213
4172651
8942746
8505224
2231012
8544081
8965217
1158771
6576854
9071103
7357669
4741912
6395018...

result:

ok 10777 lines

Test #5:

score: 5
Accepted
time: 103ms
memory: 23616kb

input:

45653 41902 4855921 1516929
1864126 4848519 1738964 1684108 2951498 2481769 2192195 366663 243189 166942 1911910 3790775 317961 3577935 4132879 1906397 832219 1000149 1876696 1712377 1804779 4416901 1209666 2452851 1875347 4787361 2090422 2095533 4472601 4076543 2273567 3068870 1785684 2158991 44186...

output:

4086942
3996321
325476
3098607
1400981
2767738
2551826
721561
686526
1183295
4454167
767101
1614315
263442
2444619
3775866
4481567
4276352
1659900
659072
1908581
2861253
124950
2781694
3187901
3711446
2345836
3338889
1240565
604118
1454344
3162657
3611279
1317979
3104117
2957245
2653061
2079971
1029...

result:

ok 20929 lines

Test #6:

score: 5
Accepted
time: 82ms
memory: 22584kb

input:

20440 22424 22087836 13788806
299852 3725954 18535134 10343492 2862529 15598416 6856415 14491334 6564398 7744792 9433529 16488700 3916706 11798221 8514408 19584552 9630801 10884385 10343712 20201076 15395616 5427021 13803053 6764330 9294436 3439835 10453996 3665941 7456784 10276346 6192321 5445905 2...

output:

967655
907661
18238287
18253167
21055876
3264392
14976188
9373754
19492254
20046556
17678434
15326289
14077108
6955504
6692653
3118641
3051925
18593341
12388843
6907357
4361382
19943482
19794068
16272641
20219922
21308576
5552021
17042958
13832466
14718470
7605758
2161924
22057074
182974
5981232
232...

result:

ok 11347 lines

Test #7:

score: 5
Accepted
time: 99ms
memory: 23028kb

input:

45135 47326 2 1
1 1 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 0 1 ...

output:

0
1
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
1
0
1
0
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
1
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
0
1
...

result:

ok 23555 lines

Test #8:

score: 5
Accepted
time: 25ms
memory: 24640kb

input:

23895 22697 2 1
1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 0 1 ...

output:

1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
1
1
0
0
1
0
0
0
1
0
1
1
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
0
1
0
1
1
1
0
1
1
0
1
0
1
1
1
1
0
0
0
1
1
0
0
0
1
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
...

result:

ok 11328 lines

Test #9:

score: 5
Accepted
time: 82ms
memory: 25476kb

input:

40185 40441 3 2
0 2 0 1 2 1 2 2 0 1 2 1 1 1 2 0 1 0 2 0 1 2 0 2 0 1 1 2 0 2 2 2 1 2 1 2 0 0 2 1 0 0 2 2 1 2 2 1 2 1 0 2 0 0 2 2 2 2 1 2 0 1 0 2 2 0 1 1 1 1 1 0 2 1 0 1 1 2 0 0 2 0 2 2 1 2 2 0 1 1 2 2 1 1 0 1 2 1 0 2 0 2 0 0 0 1 1 1 1 2 1 1 0 2 1 2 1 2 1 0 2 2 0 2 1 2 1 1 2 2 2 0 1 2 0 1 2 0 2 1 0 2 ...

output:

0
1
0
2
0
0
0
0
0
1
0
1
1
1
2
2
0
0
2
2
1
1
2
0
1
1
2
2
2
0
2
2
2
1
0
2
1
0
0
0
0
2
1
0
1
1
0
1
2
1
0
0
0
2
0
1
2
2
0
0
2
2
1
1
0
0
0
2
2
1
2
1
0
1
0
2
0
1
0
0
2
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
2
0
1
0
2
0
0
0
1
0
0
2
2
2
1
2
0
2
1
2
1
1
2
2
2
0
0
1
2
2
2
0
0
0
1
2
1
2
0
0
2
0
0
1
2
0
1
2
0
2
0
2
...

result:

ok 20308 lines

Test #10:

score: 5
Accepted
time: 24ms
memory: 21112kb

input:

21254 20964 3 1
1 2 1 0 0 2 0 1 1 0 0 2 2 1 2 1 2 0 1 0 2 1 1 0 0 0 0 0 0 0 1 1 1 0 1 2 0 0 1 1 0 0 2 2 1 0 2 2 1 2 2 0 1 1 1 1 0 0 2 0 0 1 0 1 0 1 1 0 2 1 2 1 1 2 1 2 0 2 0 0 1 0 2 2 1 2 1 0 2 1 1 2 2 2 1 1 1 1 2 2 2 0 2 1 0 0 2 1 2 2 1 2 1 2 1 1 1 1 2 2 1 1 2 2 0 0 1 2 2 1 0 2 1 1 0 0 0 0 2 0 2 0 ...

output:

0
0
0
2
2
1
2
2
1
1
0
0
2
1
1
2
0
0
2
0
0
2
1
1
2
2
1
0
2
0
0
0
2
2
1
0
1
2
1
2
2
0
2
1
0
2
1
0
0
0
2
2
0
2
1
0
0
2
2
2
1
2
2
0
0
1
1
1
1
2
1
2
0
2
0
1
2
1
1
1
2
0
0
1
1
0
2
0
0
1
1
0
0
1
1
2
1
0
1
1
1
0
2
0
0
1
0
1
2
0
1
1
1
1
0
1
2
1
2
1
1
1
1
1
0
0
1
2
1
2
1
2
1
1
1
2
2
2
1
2
1
1
2
2
0
1
2
1
2
1
...

result:

ok 10441 lines

Test #11:

score: 5
Accepted
time: 129ms
memory: 23444kb

input:

43448 47334 4 3
0 2 0 2 1 3 2 0 3 1 2 3 3 0 0 2 0 1 3 3 1 0 3 3 2 0 3 2 0 3 3 0 2 1 2 1 3 3 3 2 1 1 3 3 0 1 3 2 3 3 0 2 3 1 3 3 3 2 1 0 1 0 1 1 3 0 0 2 1 1 2 0 2 1 0 1 2 2 1 1 2 0 3 0 2 0 0 0 1 1 2 3 2 2 1 1 3 1 1 0 0 3 0 1 0 1 3 1 2 0 0 3 3 2 3 1 0 3 0 3 0 1 2 2 2 1 1 3 0 1 0 2 3 1 3 1 3 0 2 2 0 0 ...

output:

2
1
3
0
3
0
2
1
1
2
3
1
1
0
1
3
0
1
1
2
0
1
2
0
2
0
3
3
0
2
2
2
3
2
0
2
1
2
3
3
3
3
1
2
1
1
0
0
1
2
2
3
3
3
3
2
0
3
0
2
0
0
0
2
0
1
3
3
0
0
3
0
2
0
1
2
1
0
3
2
2
0
0
2
0
0
3
0
3
1
0
3
0
2
3
3
1
0
2
0
2
1
3
1
1
1
1
2
1
3
2
2
0
1
0
0
1
2
3
2
3
1
1
2
2
1
3
3
2
1
2
0
1
3
1
1
3
3
2
1
3
1
1
0
3
1
1
2
0
3
...

result:

ok 23559 lines

Test #12:

score: 5
Accepted
time: 77ms
memory: 22564kb

input:

21682 23277 4 3
2 3 0 2 1 2 2 0 3 2 0 3 3 1 3 2 0 1 2 0 1 2 3 3 0 1 1 3 3 2 1 0 0 1 1 1 0 2 2 2 1 3 1 1 0 1 1 0 0 1 2 0 2 2 3 0 1 1 2 2 2 0 2 2 1 0 3 2 2 2 1 2 1 2 1 2 3 3 0 0 1 2 3 0 1 3 2 1 1 1 1 2 2 0 3 1 0 3 0 3 3 1 3 1 1 2 3 3 3 2 2 3 1 2 2 1 1 0 3 1 1 0 0 1 0 0 1 1 0 1 3 0 3 0 2 2 3 1 3 2 0 1 ...

output:

2
0
2
2
0
3
3
1
3
2
0
1
3
2
2
2
2
2
2
2
2
0
0
3
3
3
0
2
0
0
2
2
1
0
0
1
1
0
1
2
1
3
2
2
0
2
0
1
0
0
0
0
1
3
2
3
1
2
3
2
1
0
1
2
3
3
1
1
0
3
2
3
0
1
1
2
3
0
2
3
0
1
0
3
1
3
3
3
0
0
2
1
0
1
1
2
2
3
0
0
0
2
1
2
3
3
3
1
2
0
0
1
0
0
1
2
1
1
0
0
0
0
2
2
0
1
1
1
2
3
0
2
0
0
0
1
2
0
1
3
3
0
3
0
0
3
2
2
1
2
...

result:

ok 11539 lines

Test #13:

score: 5
Accepted
time: 6ms
memory: 20500kb

input:

100 100 65395230 35881714
62142195 19706133 28647489 33450222 48824506 8015154 46541425 16938863 64792759 48227269 6896697 21723841 7041187 14950522 37810236 63082187 37644871 25289010 6995498 18738693 58887782 24150987 45707180 20433758 37690032 13107477 51913203 47307693 34043407 56946152 43712656...

output:

18389247
24237024
50091880
50924464
56946152
56785114
13826153
57752902
37221389
60909537
22970665
1652148
61467055
48535910
63412074
24875632
22195094
28180544
16268319
39914963
59603824
46691956
37349399
61510538
15959540
50964784
35129602
4781374
41586501
30074778
39377500
41405873
50460526
57303...

result:

ok 52 lines

Test #14:

score: 5
Accepted
time: 8ms
memory: 20492kb

input:

100 100 12678909 7538356
2201473 5661370 2769279 10561937 7492323 1433421 9060089 12481348 9433373 8243661 10699475 7503539 9390548 7629765 5692055 11072808 3060561 11608574 979011 580858 10217189 8184373 4795988 12281050 12612416 10915825 1673084 10909889 10289444 63871 5649334 7362221 2974515 6552...

output:

8485943
518635
3950759
4890470
6858835
2493268
7852074
10333858
8933168
1336668
344752
5907004
4420428
2689985
1978148
1345229
1863827
6031349
10324669
6757399
9060089
8472665
5616992
11482421
384125
10043664
9070216
9871351
7733125
10003085
11116466
866474
3179010
1336668
12533322
5528477
2252643
1...

result:

ok 57 lines

Test #15:

score: 5
Accepted
time: 9ms
memory: 22560kb

input:

100 100 36605287 36140629
928163 757781 848266 35758454 11245332 25344601 13794272 11245874 10785090 14264236 22516152 30968187 29958405 23229254 15129551 2336761 8372745 24483921 21387830 14740458 36083451 18334210 29693065 8496923 36034359 899469 3451835 19794908 13109192 13471331 10571588 9426056...

output:

8592249
13034491
28244942
12929543
6747721
35874182
30417980
16503879
11854799
1687377
30017451
23806457
3516635
14720965
30486799
31850187
15230021
17972408
12927260
12735206
16456109
6444490
31100382
10628133
23711975
16609210
6153486
19926422
28791026
36083451
32274045
26443486
23065162
7162675
1...

result:

ok 49 lines

Test #16:

score: 5
Accepted
time: 9ms
memory: 22556kb

input:

100 100 47899891 45117151
15500708 3364986 30436889 4248 24233393 43480876 32962716 2575011 30076950 42729768 34711652 43877392 46696363 11004071 45766924 19172026 19310588 4920427 45418331 39857639 22432943 8555735 1072155 887503 14417379 9005106 3355397 23477839 43277886 9881889 40333676 19161021 ...

output:

40751939
47353718
38542758
35281512
22323601
21356240
12544663
1072155
9964582
38542758
14967331
24226138
22782095
6438590
30401051
23477839
7456462
40012848
39841088
45590039
46882618
13467248
15138159
19726711
37678710
15138159
42052066
17714786
43877392
28393517
44214212
27506775
38721187
9964582...

result:

ok 56 lines

Test #17:

score: 5
Accepted
time: 369ms
memory: 21628kb

input:

44329 45755 68619429 6566086
843174 65229649 59125415 67821377 18689145 32418611 44992263 14973870 35070569 55503111 68255443 39631384 34675944 37469704 5042695 27118881 37925381 44788140 12166241 10168253 14558444 25523027 5622485 451693 54967664 4638370 23588770 43558745 7141255 15734195 16456462 ...

output:

59840104
67934869
58740502
63332121
43805399
39045266
24110708
45477132
55652306
15093485
50501371
62844526
39523938
14485425
2442556
20032230
67836923
59189027
36133336
16663700
37359343
19040252
43684134
4322000
18569155
32035907
5328503
30900740
58886072
62551108
64026612
11902692
15444142
267397...

result:

ok 22767 lines

Test #18:

score: 5
Accepted
time: 166ms
memory: 23104kb

input:

22546 22419 78515632 36554488
63733797 51094082 72419096 41102325 50264394 26786070 6547265 50849474 41765297 71170341 32475658 59598617 43602737 35970848 21281454 53371590 70848844 25965861 22291904 46360888 76643665 62411638 65081324 18727899 18358254 1183723 75155597 54917759 11203300 1336991 354...

output:

71668064
77736829
58131546
54084631
47985479
3443344
27723760
22214992
45732270
1031733
6074656
13414795
74814000
14473328
75336688
20752194
57659993
22489819
40868064
60626304
8856592
22749328
62137616
41400368
11055632
72580944
46849280
39704512
76274272
21260800
20525088
3945632
78344640
43331434...

result:

ok 11294 lines

Test #19:

score: 5
Accepted
time: 425ms
memory: 27248kb

input:

49162 41842 19949056 11777677
16867366 16906181 6606587 10031764 17987515 10305821 431586 1631720 9356732 4759175 529483 9879136 8727975 15639532 8175603 4200362 2924698 15351957 3082940 10200939 9486171 15668947 16369937 13326017 5582879 7312405 18138571 10003496 6923706 8718438 17504387 622462 113...

output:

794086
7082217
6734670
6098741
15759886
10901085
11417030
9468409
16989236
18465551
18594207
18548271
16324216
18517647
18264622
5001030
4595041
5387361
10321114
7029013
8962215
15497519
922744
978672
16072126
3690976
10983878
4147190
621932
5411808
19054114
19783230
5599015
10675464
11863292
1179
9...

result:

ok 20967 lines

Test #20:

score: 5
Accepted
time: 156ms
memory: 21152kb

input:

22028 22371 6135536 508738
2937934 4141578 949738 3048488 4615707 964740 4457403 5571871 2559404 2086996 3402665 1274696 1421557 6098141 5218241 1511269 3234575 2746297 5212454 5216571 5364813 4782039 3292407 3143999 807305 4219491 4785536 625836 2552956 5611816 2745663 2144812 5314414 5548673 41201...

output:

2107923
5949237
381961
4430668
1709613
2321856
3082530
2148832
3731312
751328
2717030
5805648
2787344
4207136
1662976
2301088
5329472
1578864
1059136
781088
2685456
1603888
5305408
1566672
260512
2452800
5439600
2168784
273344
2691488
4509296
2008832
1843632
3574846
1590288
2011264
178592
2824016
56...

result:

ok 11115 lines

Extra Test:

score: -3
Extra Test Failed : Wrong Answer on 4
time: 13ms
memory: 22668kb

input:

1 4 68126603 34175647
9699309
0 1 1
1 1 1
0 1 1
1 1 1

output:

49498124
0

result:

wrong answer 2nd lines differ - expected: '1268001', found: '0'