QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140275#4555. 石家庄的工人阶级队伍比较坚强myee100 ✓244ms22304kbC++116.0kb2023-08-15 16:48:582023-08-15 16:49:00

Judging History

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

  • [2023-08-15 16:49:00]
  • 评测
  • 测评结果:100
  • 用时:244ms
  • 内存:22304kb
  • [2023-08-15 16:48:58]
  • 提交

answer

// 那就是希望。
// 即便需要取模,也是光明。

#include <algorithm>
#include <stdio.h>
#include <vector>
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
    T ans=1%mod;
    while(index)
    {
        if(index&1)ans=ans*base%mod;
        base=base*base%mod,index>>=1;
    }
    return ans;
}
namespace AnyMod
{
    ullt Mod=-1;
    inline voi ChgMod(ullt v){Mod=v;}
    struct ModInt
    {
        private:
            ullt v;inline ullt chg(ullt w){return(w<Mod)?w:w-Mod;}
            inline ModInt _chg(ullt w){ModInt ans;ans.v=(w<Mod)?w:w-Mod;return ans;}
        public:
            ModInt():v(0){}
            ModInt(ullt v):v(v%Mod){}
            bol empty(){return!v;}
            inline ullt val(){return v;}
            friend bol operator<(ModInt a,ModInt b){return a.v<b.v;}
            friend bol operator>(ModInt a,ModInt b){return a.v>b.v;}
            friend bol operator<=(ModInt a,ModInt b){return a.v<=b.v;}
            friend bol operator>=(ModInt a,ModInt b){return a.v>=b.v;}
            friend bol operator==(ModInt a,ModInt b){return a.v==b.v;}
            friend bol operator!=(ModInt a,ModInt b){return a.v!=b.v;}
            inline friend ModInt operator+(ModInt a,ModInt b){return a._chg(a.v+b.v);}
            inline friend ModInt operator-(ModInt a,ModInt b){return a._chg(a.v+a.chg(Mod-b.v));}
            inline friend ModInt operator*(ModInt a,ModInt b){return a.v*b.v;}
            friend ModInt operator/(ModInt a,ModInt b){return b._power(Mod-2)*a.v;}
            friend ModInt operator^(ModInt a,ullt b){return a._power(b);}
            inline ModInt operator-(){return _chg(Mod-v);}
            ModInt sqrt()
            {
                if(power(v,(Mod-1)>>1,Mod)!=1)return 0;
                ModInt b=1;do b++;while(b._power((Mod-1)>>1)==1);
                ullt t=Mod-1,s=0,k=1;while(!(t&1))s++,t>>=1;
                ModInt x=_power((t+1)>>1),e=_power(t);
                while(k<s)
                {
                    if(e._power(1llu<<(s-k-1))!=1)x*=b._power((1llu<<(k-1))*t);
                    e=_power(Mod-2)*x*x,k++;
                }
                return _min(x,-x),x;
            }
            ModInt inv(){return _power(Mod-2);}
            ModInt _power(ullt index){ModInt ans(1),w(v);while(index){if(index&1)ans*=w;w*=w,index>>=1;}return ans;}
            voi read(){v=0;chr c;do c=getchar();while(c>'9'||c<'0');do v=(c-'0'+v*10)%Mod,c=getchar();while(c>='0'&&c<='9');v%=Mod;}
            voi print()
            {
                static chr C[20];uint tp=0;
                ullt w=v;do C[tp++]=w%10+'0',w/=10;while(w);
                while(tp--)putchar(C[tp]);
            }
            voi println(){print(),putchar('\n');}
            ModInt operator++(int){ModInt ans=*this;return v=chg(v+1),ans;}
        public:
            inline ullt&operator()(){return v;}
            inline ModInt&operator+=(ModInt b){return*this=_chg(v+b.v);}
            inline ModInt&operator-=(ModInt b){return*this=_chg(v+chg(Mod-b.v));}
            inline ModInt&operator*=(ModInt b){return*this=v*b.v;}
            ModInt&operator^=(ullt b){return*this=_power(b);}
            ModInt&operator/=(ModInt b){return*this=b._power(Mod-2)*v;}
            ModInt&operator++(){return v=chg(v+1),*this;}
    };
}
// Heaven and Earth... My guiding star...
using modint = AnyMod::ModInt;
struct num
{
    modint a,b;
    num():a(),b(){}
    num(modint a):a(a),b(){}
    num(modint a,modint b):a(a),b(b){}
    friend num operator+(num a,num b){return{a.a+b.a,a.b+b.b};}
    friend num operator-(num a,num b){return{a.a-b.a,a.b-b.b};}
    friend num operator*(num a,num b){return{a.a*b.a-a.b*b.b,a.b*b.a+b.b*a.a-a.b*b.b};}
};
uint Pow3[13],Cnt1[531442],Cnt2[531442];
num A[531442],B[531442],D[13][13];
num Pow(num base,uint t)
{
    num ans(1);
    while(t)
    {
        if(t&1)ans=ans*base;
        if((t>>=1))base=base*base;
    }
    return ans;
}
int main()
{
#ifdef MYEE
    freopen("QAQ.in","r",stdin);
    freopen("QAQ.out","w",stdout);
#endif
    uint n,t,p;scanf("%u%u%u",&n,&t,&p),AnyMod::ChgMod(p);
    Pow3[0]=1;for(uint i=0;i<n;i++)Pow3[i+1]=Pow3[i]*3;
    for(uint i=0;i<Pow3[n];i++)Cnt1[i]=Cnt1[i/3]+(i%3==1),Cnt2[i]=Cnt2[i/3]+(i%3==2);
    for(uint i=0;i<Pow3[n];i++)A[i].a.read();
    for(uint i=0;i<=n;i++)for(uint j=0;i+j<=n;j++)D[i][j].a.read();
    for(uint i=0;i<Pow3[n];i++)B[i]=D[Cnt1[i]][Cnt2[i]];
    for(uint i=0;i<n;i++)for(uint j=0;j<Pow3[n];j++)if(j/Pow3[i]%3==0)
    {
        num u=A[j+Pow3[i]],v=A[j+Pow3[i]*2];
        A[j+Pow3[i]*2]=A[j]-u*num(1,1)+v*num(0,1),A[j+Pow3[i]]=A[j]+u*num(0,1)-v*num(1,1),A[j]=A[j]+u+v;
    }
    for(uint i=0;i<n;i++)for(uint j=0;j<Pow3[n];j++)if(j/Pow3[i]%3==0)
    {
        num u=B[j+Pow3[i]],v=B[j+Pow3[i]*2];
        B[j+Pow3[i]*2]=B[j]-u*num(1,1)+v*num(0,1),B[j+Pow3[i]]=B[j]+u*num(0,1)-v*num(1,1),B[j]=B[j]+u+v;
    }
    for(uint i=0;i<Pow3[n];i++)D[Cnt1[i]][Cnt2[i]]=B[i];
    for(uint i=0;i<=n;i++)for(uint j=0;i+j<=n;j++)D[i][j]=Pow(D[i][j],t);
    for(uint i=0;i<Pow3[n];i++)A[i]=A[i]*D[Cnt1[i]][Cnt2[i]];
    for(uint i=0;i<n;i++)for(uint j=0;j<Pow3[n];j++)if(j/Pow3[i]%3==0)
    {
        num u=A[j+Pow3[i]],v=A[j+Pow3[i]*2];
        A[j+Pow3[i]*2]=A[j]+u*num(0,1)-v*num(1,1),A[j+Pow3[i]]=A[j]-u*num(1,1)+v*num(0,1),A[j]=A[j]+u+v;
    }
    modint w=modint((p+1)%3?(p*2+1)/3:(p+1)/3)^n;
    for(uint i=0;i<Pow3[n];i++)(A[i].a*w).println();
    return 0;
}

// 那就是希望。
// 即便需要取模,也是光明。

详细

Test #1:

score: 5
Accepted
time: 0ms
memory: 18080kb

input:

3 532 214632061
9043356 146372181 146678454 64676583 16740935 175871555 98597859 116368864 10703972 131551545 189335670 15365384 26562526 179152327 211984789 12921820 98023790 171197100 164965352 115067748 116698308 59176992 177174386 109284524 35817894 178671763 165387105
62427436 156995344 1833109...

output:

132389456
199653204
5906715
57981474
35047569
168839511
177179521
15468435
36415747
118905447
212453713
2779893
19066061
158667219
148490368
132928950
128566194
21608909
58892650
212490872
161043391
127122166
116831873
143742111
27381586
176665638
80920294

result:

ok 27 numbers

Test #2:

score: 5
Accepted
time: 0ms
memory: 19520kb

input:

4 532 447587731
210388236 316123346 213929922 215476732 417493341 361881602 325894740 18599996 228489642 346948011 286692912 333347263 93539038 82313523 313428621 384401622 247961135 63221929 373519144 27598061 234625084 346095425 328114785 253885596 58856777 14154042 422298127 115611925 210208885 2...

output:

178326587
356755657
289777832
103459887
13928184
98335962
208923907
127598211
250996393
182021131
25334190
305943210
428308852
433591723
233790123
285988632
122067553
431889869
198904745
106183076
173157197
54539426
319082838
357614639
222761531
410103147
316866482
87639755
100941335
186472180
25822...

result:

ok 81 numbers

Test #3:

score: 5
Accepted
time: 0ms
memory: 19044kb

input:

3 476378538 12571459
8086617 10453594 11491171 4689719 849802 996762 10490264 12135678 7819114 10181688 6005960 12368941 6919314 12077658 6344807 11132969 802841 10352643 10062964 12021822 6870361 7590881 7920762 5265622 12249726 8267930 744004
9292135 5390286 5967848 10490690
1761276 3325528 587455...

output:

2536122
9107766
285578
6724097
4091777
11336880
8325240
1340761
3798995
9509327
5969792
6036206
521369
6272336
7754809
6480349
4612517
10253657
10384985
12170476
5906156
4979207
4965379
2416847
5844941
3701372
323265

result:

ok 27 numbers

Test #4:

score: 5
Accepted
time: 2ms
memory: 18940kb

input:

4 476378538 575081563
120637494 437573676 3057051 28966199 466996506 247098849 248497981 528259037 503585727 390947456 24757037 317704848 130907153 310363492 373560768 206537298 499241063 77617958 435796066 249890766 65743489 306758609 362166747 493798862 567211154 343656313 442657603 355067271 6183...

output:

38315500
417931641
339346528
120122993
186481572
31515158
237558750
138086681
158714937
20604598
526125817
35930146
324393531
83068471
555685208
500331613
471550868
218057024
402901697
92365150
66317020
224121612
174408150
332384588
504474472
393918974
308689419
97598806
120445217
403069088
48598347...

result:

ok 81 numbers

Test #5:

score: 5
Accepted
time: 4ms
memory: 18676kb

input:

5 476378538 915698197
384215208 619116315 698374683 29333662 502569220 522795582 764188184 273876900 257083512 78548670 838607763 638609787 154391550 661474985 756573675 336896967 663419645 876911081 619858385 369952598 351902134 709129390 650067275 190747450 172611867 364975639 737106695 533044212 ...

output:

712482278
181655846
267222696
285415632
548780139
107973062
16658996
68717148
843799947
557806583
447441351
249240221
905691157
913836425
532187944
713980859
278364730
304680919
776942022
686873842
329418562
547330195
539693043
650224968
395593440
62937731
386503585
651387439
242770283
648354345
615...

result:

ok 243 numbers

Test #6:

score: 5
Accepted
time: 0ms
memory: 19912kb

input:

5 476378538 971936953
203904858 32376651 299883651 554630524 500119535 88520677 869571122 467933418 62631557 922713675 339818532 798760302 250244916 451025864 216830700 894001868 459910254 885740840 475353657 433748447 419202533 780416961 32606837 546884191 832653613 705093933 625269836 64896059 224...

output:

823712327
375828551
146576007
858028733
123730633
109586265
454807319
925318436
960352241
124313213
469066335
296744254
43656011
637040045
615240583
530879845
697538570
803265837
761585203
897197466
311975590
142472960
503389950
356617878
680090341
693081661
281406726
106748272
255868651
575552623
2...

result:

ok 243 numbers

Test #7:

score: 5
Accepted
time: 4ms
memory: 18736kb

input:

6 476378538 4126711
639799 1906750 1482864 4010558 3323519 2248552 306839 1022114 2022783 89154 571256 2213424 2835951 568484 814355 1152120 1056012 929954 83129 668609 1382533 2568553 2264721 2648320 1580766 776667 2364001 665269 2029437 376839 2459128 1105694 2664083 1404757 2962604 3265449 254856...

output:

751872
578639
3367688
470581
3651583
2106575
3019598
923439
2086449
1008233
2958496
1637080
2335613
3511706
3951826
3953186
3471594
2590965
3175172
2552104
1486136
21723
2229816
21729
2473676
3679883
3013560
1779336
468706
2123794
2017113
3820186
607015
777232
2889794
1183296
3794818
859971
2697076
...

result:

ok 729 numbers

Test #8:

score: 5
Accepted
time: 5ms
memory: 19696kb

input:

7 476378538 94057333
57824400 77405026 78671278 73702058 493426 37134357 87651894 24370090 13965791 63472010 54183893 19948952 23707751 78965322 18597252 84389893 16779968 18182118 61141766 84168298 70884941 81965711 61025786 35140861 60486906 59505482 35326985 86471303 87270875 36171839 92600439 37...

output:

12545582
1641905
10989434
79020253
8527063
51582120
29955497
5868942
56897661
52505398
39707093
21254642
48607786
87919253
55258165
1159896
35513242
20295387
35062994
28197568
24563571
9449949
74007813
55143858
23530514
46798480
65859154
62942230
27015992
73179594
59090448
5743968
38912667
55051876
...

result:

ok 2187 numbers

Test #9:

score: 5
Accepted
time: 10ms
memory: 18524kb

input:

9 476378538 7
1 3 2 3 3 0 1 4 2 5 4 5 6 1 4 0 5 3 1 1 3 1 1 3 6 0 3 2 2 1 3 6 3 4 6 5 1 1 0 2 2 3 6 3 2 6 0 6 0 6 0 6 0 1 0 5 5 1 4 3 6 2 0 0 0 5 6 0 0 1 6 3 6 4 1 0 0 0 1 2 1 0 3 1 1 0 6 4 0 0 0 5 5 5 2 6 4 4 1 2 6 2 4 3 4 6 0 1 5 5 3 1 6 6 6 1 3 3 1 0 0 2 5 1 1 3 6 2 6 0 1 0 3 4 5 1 5 6 6 6 5 6 6 ...

output:

0
3
6
5
0
0
3
1
6
0
3
1
2
2
2
1
1
0
4
0
4
2
2
4
4
5
0
2
0
1
2
5
5
1
0
1
1
1
2
2
6
4
5
5
6
4
3
6
5
6
6
6
5
5
4
4
6
6
3
0
3
6
3
5
4
0
6
6
1
0
2
4
0
3
3
5
6
1
3
6
1
2
5
5
4
6
1
1
4
2
0
0
0
5
4
1
0
0
1
0
0
6
5
1
4
1
5
6
5
0
2
1
5
1
5
5
0
0
3
4
5
1
2
0
1
1
2
0
1
4
3
4
2
2
0
4
5
3
3
1
6
4
2
2
1
5
5
2
2
4
...

result:

ok 19683 numbers

Test #10:

score: 5
Accepted
time: 19ms
memory: 20004kb

input:

10 476378538 7
4 0 1 4 1 0 5 1 2 2 6 3 4 3 3 2 5 3 4 6 6 3 4 0 2 4 1 2 0 4 0 2 6 5 1 6 1 5 4 1 5 5 4 4 3 1 3 5 0 3 3 4 0 3 0 1 2 1 6 6 2 6 2 1 2 4 2 6 6 3 4 1 2 6 6 1 3 2 3 6 5 2 5 3 1 2 4 4 6 4 1 1 2 0 3 6 0 6 6 3 4 3 5 3 5 5 3 5 4 0 6 3 1 3 0 3 6 6 5 0 1 2 6 2 6 1 2 0 3 2 3 6 6 6 3 5 0 4 1 0 3 4 0...

output:

3
2
0
5
0
0
6
6
4
4
2
3
3
1
2
0
6
5
5
0
1
2
3
0
1
5
3
5
1
0
4
1
4
5
2
2
5
4
6
4
2
5
0
5
6
6
4
6
1
3
3
2
6
1
5
1
5
2
5
6
2
5
5
2
1
5
3
1
0
4
2
5
1
4
6
1
1
3
3
2
5
0
0
4
1
1
0
4
2
6
2
0
0
0
5
5
6
2
2
4
5
4
2
6
6
5
2
4
2
1
4
5
2
4
5
5
0
2
4
4
6
2
0
5
3
5
5
1
6
2
6
5
4
5
2
5
2
1
2
0
2
2
4
4
2
4
2
2
6
3
...

result:

ok 59049 numbers

Test #11:

score: 5
Accepted
time: 65ms
memory: 20752kb

input:

11 476378538 7
6 0 0 1 1 1 0 6 1 2 3 1 1 2 4 2 5 6 4 5 6 0 4 0 2 1 4 2 0 4 5 2 5 0 1 5 6 3 2 2 4 2 5 3 3 1 0 5 4 4 0 2 3 4 4 0 4 6 5 2 3 3 2 2 4 6 6 5 6 4 4 6 6 5 6 6 1 2 2 0 5 0 3 3 6 1 0 6 6 3 3 0 5 3 6 3 5 3 1 3 3 4 2 5 0 3 2 4 2 5 3 5 3 4 5 1 4 0 0 2 4 6 4 2 2 2 2 2 0 6 6 1 5 4 5 6 5 3 6 5 5 5 1...

output:

1
1
5
4
5
2
3
1
5
6
4
0
1
1
1
3
3
1
5
6
4
4
6
4
0
6
5
6
4
3
1
3
1
4
1
5
5
2
0
2
5
6
0
3
4
4
4
6
3
6
4
1
0
5
0
1
1
2
2
0
3
0
4
0
5
5
6
2
1
0
0
5
4
0
3
6
1
5
1
3
0
5
1
6
0
6
1
2
6
6
1
6
1
3
1
3
0
1
3
0
2
4
1
5
6
6
4
0
5
0
2
5
2
5
2
0
1
2
4
4
3
3
2
2
5
2
0
1
2
2
4
0
3
0
6
1
3
1
2
0
4
5
2
5
2
2
5
1
6
1
...

result:

ok 177147 numbers

Test #12:

score: 5
Accepted
time: 211ms
memory: 22268kb

input:

12 476378538 7
5 0 6 2 2 6 5 6 6 2 0 2 5 2 0 5 3 1 2 5 5 4 4 1 0 6 4 5 4 3 2 5 6 1 5 5 5 0 6 0 5 3 1 0 6 0 3 4 5 1 4 2 4 2 1 2 5 5 6 5 1 1 1 6 0 5 0 4 6 6 4 0 4 1 4 1 2 2 2 6 6 4 2 5 6 1 1 2 4 0 5 3 5 0 5 6 4 3 1 6 3 0 2 1 1 3 4 1 1 5 0 4 6 4 6 0 1 1 3 0 6 4 2 3 3 5 2 2 5 3 0 2 4 1 2 6 4 1 1 5 6 0 4...

output:

4
2
6
4
3
6
2
4
4
4
6
5
1
6
4
1
6
0
1
4
4
5
2
6
1
6
6
2
6
2
3
4
4
1
6
0
4
5
0
2
2
1
1
4
6
1
1
2
2
4
1
4
1
5
6
0
6
4
0
3
4
5
1
3
0
5
5
2
3
2
2
3
5
5
1
4
4
1
1
2
6
0
1
6
4
0
4
2
0
1
3
2
0
2
1
6
1
1
4
0
4
6
4
3
2
1
0
6
1
0
0
0
0
5
2
0
4
3
2
5
4
3
4
4
1
1
2
2
3
0
5
3
6
3
4
6
4
6
4
4
5
6
2
6
2
3
2
0
2
6
...

result:

ok 531441 numbers

Test #13:

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

input:

9 476378538 24259381
10288069 6854164 4788004 19221668 18559380 9968188 9008951 21020970 16854759 6880723 22745553 12336004 8062002 3975104 3602089 23822625 18161285 13146657 12373386 12532381 9789299 12979843 4944167 15461011 5686230 10108712 3341266 24130047 12372995 7819252 3041343 5052611 197337...

output:

9077063
16394852
21560817
12319622
4596521
11296674
11206031
24111484
463578
22566975
14082843
241013
20437918
19501792
7747569
17057653
12702119
19824233
13990150
9678717
7294305
14797857
19231150
23438373
1820395
14960992
1383378
20013344
1856773
1760480
11884513
19660698
3544603
12024950
4572186
...

result:

ok 19683 numbers

Test #14:

score: 5
Accepted
time: 26ms
memory: 20236kb

input:

10 476378538 482834857
20202355 94934130 92455997 372871192 350038258 266635764 130685767 153957617 379144269 1672153 123963520 344345057 182635230 341983237 336799006 211241639 3093239 471841536 98794568 476223229 463283348 90681950 105519208 104308549 23921648 170003033 466573083 441643238 1450807...

output:

367378055
466377755
68531810
130570170
293413729
22091186
352994571
39289574
185061912
419570410
216906486
158057985
309826031
398539708
205282369
143355589
176841924
180469499
323049306
202798665
342940869
294442885
349413247
105359324
344832040
200942605
167024804
327712245
461417272
36392389
4885...

result:

ok 59049 numbers

Test #15:

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

input:

11 476378538 972009301
203436325 703061239 57572681 311331193 769156473 528199260 528091913 343422864 898577246 169741292 462928880 914814340 571462006 931317934 814673580 343278250 748276575 479022366 204442017 925448467 750115423 420642585 655532371 800665216 102116797 645312701 752099172 25379624...

output:

319980258
836403280
85067487
169354746
14929691
617169243
27056821
258382706
604431626
303466786
582693558
591643350
805685058
354697277
713169392
119981047
266074170
361551589
244009416
570219812
885323769
533845603
732983467
171637314
157240568
655888615
382623277
222525660
521046000
16781754
9335...

result:

ok 177147 numbers

Test #16:

score: 5
Accepted
time: 240ms
memory: 22288kb

input:

12 476378538 851313877
809783697 127759246 452575075 522670525 21162362 154653948 709393110 510092301 82661576 604374304 770179619 401568908 152505704 99615724 333630025 87620587 12887298 409155410 790609913 49416869 330995818 523353152 41991738 289548740 250474942 235373366 737190712 87023976 61856...

output:

182054744
152955309
367723765
656170291
398641752
659406869
123483680
36395657
741598176
200359456
608602898
16499688
64866875
453796147
478615997
231593917
625893454
505324422
452414035
177707259
291586909
76312071
292973896
436002247
530412999
169547837
467217200
676371609
839574106
275320381
9485...

result:

ok 531441 numbers

Test #17:

score: 5
Accepted
time: 7ms
memory: 18888kb

input:

9 476378538 756663859
389822258 236360124 489869365 653692683 430298055 731925518 686070204 624394209 398898710 454790504 267965456 97980068 486939721 190211227 244641538 652899287 644378527 14665337 262669455 538022679 598799405 507150785 253758928 722365586 312124481 348876617 611540111 73398121 6...

output:

185176101
217698820
739718366
304493667
292007214
271911026
299416959
587646818
610767664
446392469
230597897
10464812
736690711
63331129
546613537
112564183
386166179
581849291
40181701
258443397
253443283
43909998
388941995
101874169
132665338
635283340
418262084
329851798
749138231
586516546
2297...

result:

ok 19683 numbers

Test #18:

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

input:

10 476378538 294236353
272835520 62630841 286928002 68660491 168948937 96022463 102005730 76690909 119613685 58163242 287853841 74065021 233704654 214497389 35957531 24444696 57684087 69398594 188666798 183922643 24331586 108622556 229532660 258857260 76875604 137782179 214125010 217585921 120140860...

output:

39865346
237045160
177944185
74266989
289677961
139264195
210876645
167508698
267073092
190043057
142184635
94485365
26315863
191356261
235679394
67384662
287142556
223828746
275884797
160804325
209835878
249014637
280625049
152388690
281752999
176148899
63681133
56062878
64065337
171795168
17024851...

result:

ok 59049 numbers

Test #19:

score: 5
Accepted
time: 74ms
memory: 19512kb

input:

11 476378538 139568251
11097646 12918728 91965757 15954249 98192343 48366624 56650343 90664174 795962 122123049 13483668 20492355 8764469 93744560 46297411 32772079 120068544 42182823 70242870 34112966 87701743 50016293 55392085 23779234 29401426 68957715 123653053 107239181 29081865 3255590 8056399...

output:

25579870
4853142
8972015
42508966
36781367
21080690
97509907
21600255
101892483
136658594
133790975
15517250
83834197
15724311
14987404
96508295
96581547
87086406
78166497
54772601
67125836
71886132
37673942
136708601
128350255
20542227
28922662
5741643
106247888
97745793
54422759
62315386
23943958
...

result:

ok 177147 numbers

Test #20:

score: 5
Accepted
time: 244ms
memory: 22304kb

input:

12 476378538 20697577
19877181 7407661 746578 7321253 12934581 2606479 6134934 6865084 17261312 15824340 10342430 1225440 16978625 18691060 16464225 6456314 3605515 17456753 12387258 16139254 6912168 18306244 8204665 3471404 3611501 9218310 11518652 16848286 12204599 13894262 18074273 14681930 64006...

output:

5399726
18773379
9387347
6122909
4160431
10653319
8361758
15088581
3615937
18526826
17411446
814220
20272828
15775507
16312928
9662755
5933146
1926845
3853444
1105061
18717834
2428345
960077
8312674
7196919
7258888
6466543
1608552
4023462
12692339
10091087
13209644
6465661
1185606
3772184
5741748
16...

result:

ok 531441 numbers

Extra Test:

score: 0
Extra Test Passed