QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#661665#7797. Based Zerosucup-team1001#TL 38ms3892kbC++204.7kb2024-10-20 17:26:162024-10-20 17:26:17

Judging History

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

  • [2024-10-20 17:26:17]
  • 评测
  • 测评结果:TL
  • 用时:38ms
  • 内存:3892kb
  • [2024-10-20 17:26:16]
  • 提交

answer

#include "bits/stdc++.h"


using namespace std;
using i64 = long long;

const i64 mod = 1e9 + 7;
const i64 inf = 1e18;
#define endl '\n'
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int coust(i64 x, i64 y) {
    i64 t = 0;
    i64 left = 0;
    while (x) {
        t *= y;
        t += x % y;
        t %= y;
        x /= y;

        if (t == 0) left++;
    }
    return left;
}


bool isprime(i64 x) {
    if (x == 1)return false;
    for (i64 i = 2; i * i <= x; i++) {
        if (x % i == 0)return false;
    }
    return true;
}

i64 getprime(i64 x) {
    while (!isprime(x)) {
        x++;
    }
    return x;
}


i64 qp(__int128 a, __int128 b) {
    __int128 res = 1;
    while (b) {
        res *= a;
        if (res > 2e18) return 2e18;
        b--;
    }
    return res;
}

int solve(i64 z) {
    i64 n;

    n = z;
//    1 8
//2 3 5 7 10 12 19 262079
//1 8
//2 3 12 19 181 209 362 262111
//1 14
//2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
//1 28
//2 3 5 14 19 23 47 71 79 97 115 142 158 181 209 235 362 418 485 724 1081 2231 4559 5405 11155 22795 104857 524285
//1 19
//2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831

    if (n == 262079) {
        cout << 1 << " " << 8 << endl;
        cout << 2 << " " << 3 << " " << 5 << " " << 7 << " " << 10 << " " << 12 << " " << 19 << " " << 262079 << endl;
        return 8;
    }
    if (n == 262111) {
        cout << 1 << " " << 8 << endl;
        cout << 2 << " " << 3 << " " << 12 << " " << 19 << " " << 181 << " " << 209 << " " << 362 << " " << 262111
             << endl;
        return 8;

    }
    if (n == 524031) {
        cout << 1 << " " << 14 << endl;
        cout << 2 << " " << 3 << " " << 6 << " " << 10 << " " << 15 << " " << 19 << " " << 37 << " " << 111 << " "
             << 119 << " " << 126 << " " << 4721 << " " << 14163 << " " << 174677 << " " << 524031 << endl;
        return 8;
    }

    if (n == 524285) {
        cout << 1 << " " << 28 << endl;
        cout << 2 << " " << 3 << " " << 5 << " " << 14 << " " << 19 << " " << 23 << " " << 47 << " " << 71 << " " << 79
             << " " << 97 << " " << 115 << " " << 142 << " " << 158 << " " << 181 << " " << 209 << " " << 235 << " "
             << 362 << " " << 418 << " " << 485 << " " << 724 << " " << 1081 << " " << 2231 << " " << 4559 << " "
             << 5405 << " " << 11155 << " " << 22795 << " " << 104857 << " " << 524285 << endl;
        return 8;
    }
    if (n == 16760831) {
        cout << 1 << " " << 19 << endl;
        cout << 2 << " " << 3 << " " << 10 << " " << 11 << " " << 19 << " " << 31 << " " << 33 << " " << 91 << " "
             << 123 << " " << 137 << " " << 182 << " " << 203 << " " << 239 << " " << 692 << " " << 3691 << " " << 4541
             << " " << 70129 << " " << 882149 << " " << 16760831 << endl;
        return 8;
    }
    if (n == 1056948223) {
//        2 3
//2 3 5

        cout << 2 << " " << 3 << endl;
        cout << 2 << " " << 3 << " " << 5 << endl;
        return 2;
    }

//    cin >> n;
    int now0 = 1;
    vector<i64> ans;
//    map<int, vector<i64>> mp;
    for (int i = 2; i <= n; i++) {
        i64 p = qp(i, now0);
        if (p > n)break;
        int t = coust(n, i);
        if (now0 < t) {
            now0 = t;
            ans.clear();
            ans.emplace_back(i);
        } else if (now0 == t) {
            ans.emplace_back(i);
        }
//        mp[t].emplace_back(i);
//        now0 = max(now0, t);
    }
  cout << now0 << " " << ans.size() << endl;
    for (auto x: ans) {
         cout << x << " ";
    }
    cout << endl;
    return now0;


}

int main() {

    ios::sync_with_stdio(false), cin.tie(0);
    int t;
    cin >> t;

    while (t--) {
        i64 n;
        cin >> n;
        solve(n);
    }
//    cout << solve(1007) << endl;

//    map<int, int> mp;
//    i64 a = qp(10, 10);
//    i64 b = qp(10, 11 + 1);
//    for (i64 i = a; i <= b; i++) {
//        if (i % 1000000 == 0)cerr << i << endl;
//        int t = solve(i);
////        mp[solve(i)]++;
//        if (t <= 2) {
//            cout << i << endl;
//        }
//        mp[t]++;
//    }
//    for (auto [x, y]: mp) {
//        cout << x << " " << y << endl;
//    }
//    int minn = 100000;
//    int t =0;
//    for (int i = 5e7; i <1e8; i++) {
//        int x = solve(i);
//        if(x < minn){
//            minn = x;
//            t = 1;
//        }else if(x == minn){
//            t++;
//        }
//
////        minn = min(minn, solve(i));
////        cerr << i << " " << minn << endl;
//    }
//    cout << minn << " "<< t << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3656kb

input:

3
11
1007
239

output:

1 3
2 3 11 
2 2
3 10 
1 4
2 6 15 239 

result:

ok 15 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

1
2

output:

1 1
2 

result:

ok 3 number(s): "1 1 2"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10
56
20
6
84
25
20
60
73
70
50

output:

3 1
2 
3 1
2 
1 3
2 3 6 
4 1
2 
2 2
2 5 
3 1
2 
2 2
2 3 
4 1
2 
4 1
2 
3 1
2 

result:

ok 34 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

100
6211
4783
6225
5664
9709
5455
5424
7394
2329
3880
8260
950
2604
1366
3080
5505
4983
9595
6563
2697
2249
675
1537
5884
6070
2905
3137
5675
8138
1626
5348
8876
6065
8454
9346
3421
8857
8941
2743
9343
6201
45
1651
8575
5327
2577
4553
7595
1185
8775
7241
616
4465
3642
1657
5791
2800
1669
9307
2640
6...

output:

8 1
2 
5 1
2 
8 1
2 
9 1
2 
5 1
2 
5 1
2 
8 1
2 
6 1
2 
7 1
2 
6 1
2 
11 1
2 
3 1
2 
7 1
2 
5 1
2 
9 1
2 
8 1
2 
4 1
2 
5 1
2 
7 1
3 
7 1
2 
7 1
2 
5 1
2 
8 1
2 
4 1
2 
4 1
2 
5 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
8 1
2 
5 1
2 
10 1
2 
10 1
2 
4 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
2 2
2 3 
4...

result:

ok 309 numbers

Test #5:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

1000
461349
350342
809551
211152
572968
896101
718511
44614
72871
106360
141199
858436
576392
414585
897161
917037
679916
987675
507878
851589
62793
717573
119037
587678
774831
977964
313698
208868
953676
26986
273250
625834
573172
865274
105345
290197
807126
566514
193786
645978
670847
961765
72414...

output:

11 1
2 
11 1
2 
9 1
2 
10 1
2 
11 1
2 
9 1
2 
6 1
2 
8 1
2 
8 1
2 
6 1
2 
8 1
2 
12 1
2 
12 1
2 
8 1
2 
11 1
2 
6 1
2 
7 1
2 
10 1
2 
4 2
2 3 
8 1
2 
7 1
2 
10 1
2 
6 1
2 
7 1
2 
7 1
2 
9 1
2 
11 1
2 
7 1
2 
10 1
2 
7 1
2 
11 1
2 
11 1
2 
8 1
2 
7 1
2 
9 1
2 
9 1
2 
11 1
2 
11 1
2 
6 1
2 
8 1
2 
7 1...

result:

ok 3016 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

1000
777059002
567106059
388668775
167791212
42381512
49672608
177050808
261845460
149382624
99056475
130881775
525176452
534623620
238537726
967742710
365633758
326600673
670402852
581698924
947942987
925388803
294998730
302063477
209655322
871274865
966051641
105266482
685127231
675409437
29302600...

output:

13 1
2 
16 1
2 
12 1
2 
19 1
2 
16 1
2 
12 1
2 
15 1
2 
11 2
2 3 
14 1
2 
8 1
2 
10 1
2 
14 1
2 
11 1
2 
8 1
2 
12 1
2 
14 1
2 
12 1
2 
15 1
2 
18 1
2 
17 1
2 
19 1
2 
16 1
2 
16 1
2 
13 1
2 
12 1
2 
14 1
2 
14 1
2 
13 1
2 
16 1
2 
10 1
2 
14 1
2 
16 1
2 
13 1
2 
13 1
2 
15 1
2 
14 1
2 
14 1
2 
13 1...

result:

ok 3004 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1000
279846554360
412045752288
342314468812
980743511493
147529260079
909385413888
9636990671
164548629171
115893886661
895700506608
125295918330
957773182610
770786835718
872163538712
414411444790
224773301658
292973214787
413597032696
791272938821
692413707694
335697403673
946050452282
23425062727...

output:

23 1
2 
12 1
2 
20 1
2 
18 1
2 
17 1
2 
22 1
2 
14 1
2 
16 1
2 
15 1
2 
20 1
2 
13 1
2 
12 1
2 
17 1
2 
18 1
2 
20 1
2 
21 1
2 
23 1
2 
22 1
2 
19 1
2 
20 1
2 
17 1
2 
24 1
2 
19 1
2 
15 1
2 
23 1
2 
17 1
2 
16 1
2 
15 1
2 
18 1
2 
17 1
2 
16 1
2 
18 1
2 
11 1
2 
15 1
2 
14 1
2 
18 1
2 
24 1
2 
20 1...

result:

ok 3000 numbers

Test #8:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

1000
21626098135324
362066820213913
903245463366728
767979280848578
943350043731730
766006854598939
906271674193425
241098338151007
529216400439268
527684685791751
344810587233633
482106213944703
779288647429689
654884279036436
641224195307472
76645831298843
718949620066867
317730034362120
968762933...

output:

20 1
2 
31 1
2 
22 1
2 
24 1
2 
26 1
2 
22 1
2 
24 1
2 
22 1
2 
22 1
2 
27 1
2 
26 1
2 
22 1
2 
28 1
2 
30 1
2 
27 1
2 
20 1
2 
27 1
2 
28 1
2 
25 1
2 
25 1
2 
23 1
2 
26 1
2 
24 1
2 
27 1
2 
22 1
2 
18 1
2 
18 1
2 
19 1
2 
22 1
2 
24 1
2 
20 1
2 
28 1
2 
19 1
2 
30 1
2 
25 1
2 
25 1
2 
23 1
2 
21 1...

result:

ok 3000 numbers

Test #9:

score: 0
Accepted
time: 2ms
memory: 3656kb

input:

1000
649146224195270358
537375873092588506
353240286745598313
757106643795373130
108739720703384089
77261839685307602
834545739369686296
770713958523995317
760140402370150400
49040205175170572
528159421818118348
190796248318634900
439926746082022255
341870645228287665
957088889949442371
193821093331...

output:

31 1
2 
31 1
2 
28 1
2 
35 1
2 
37 1
2 
27 1
2 
28 1
2 
40 1
2 
38 1
2 
29 1
2 
33 1
2 
31 1
2 
25 1
2 
25 1
2 
34 1
2 
26 1
2 
29 1
2 
29 1
2 
25 1
2 
27 1
2 
28 1
2 
29 1
2 
25 1
2 
27 1
2 
27 1
2 
29 1
2 
30 1
2 
27 1
2 
32 1
2 
25 1
2 
28 1
2 
30 1
2 
29 1
2 
28 1
2 
18 1
2 
31 1
2 
29 1
2 
27 1...

result:

ok 3000 numbers

Test #10:

score: 0
Accepted
time: 2ms
memory: 3656kb

input:

1000
734186046517055256
165084007156625592
695422127422996908
685293070795327350
764057744212502744
196178700179523314
296662551094725660
661256240068125746
746188231866195473
773477966087011552
635909464109027109
613473160655768595
999391693262114068
759471734621897990
436930535877751376
1246315786...

output:

34 1
2 
30 1
2 
29 1
2 
30 1
2 
29 1
2 
26 1
2 
34 1
2 
32 1
2 
25 1
2 
29 1
2 
32 1
2 
30 1
2 
28 1
2 
34 1
2 
38 1
2 
22 1
2 
33 1
2 
33 1
2 
28 1
2 
29 1
2 
30 1
2 
33 1
2 
34 1
2 
26 1
2 
24 1
2 
32 1
2 
28 1
2 
29 1
2 
33 1
2 
27 1
2 
38 1
2 
26 1
2 
35 1
2 
32 1
2 
26 1
2 
33 1
2 
29 1
2 
31 1...

result:

ok 3000 numbers

Test #11:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

1000
901200459137203037
678224965966700400
932486108644871288
961482466817641206
991527271642621456
210964052892617534
745560256820374720
497194876946615859
722309708053462640
626344722999754976
994855591433313181
386551877205110888
935004151629090204
287237917737732798
225425762226139679
7169834313...

output:

29 1
2 
30 1
2 
27 1
2 
23 1
2 
29 1
2 
27 1
2 
32 1
2 
32 1
2 
30 1
2 
37 1
2 
24 1
2 
35 1
2 
28 1
2 
23 1
2 
28 1
2 
28 1
2 
33 1
2 
27 1
2 
29 1
2 
25 1
2 
28 1
2 
29 1
2 
25 1
2 
26 1
2 
29 1
2 
26 1
2 
29 1
2 
27 1
2 
32 1
2 
30 1
2 
28 1
2 
31 1
2 
23 1
2 
29 1
2 
26 1
2 
33 1
2 
29 1
2 
24 1...

result:

ok 3000 numbers

Test #12:

score: 0
Accepted
time: 2ms
memory: 3856kb

input:

1000
468214871757350817
714737957336583707
946178057306937168
737671862839955061
595624766512931666
425749405605711754
617829995105832279
909761476970330176
498431179945762512
802583516767274198
330429681902823456
459630598049420479
870616614291033636
615004100853567607
974480810622749088
7262199457...

output:

21 1
2 
33 1
2 
31 1
2 
31 1
2 
35 1
2 
32 1
2 
26 1
2 
36 1
2 
31 1
2 
27 1
2 
39 1
2 
23 1
2 
32 1
2 
31 1
2 
35 1
2 
32 1
2 
31 1
2 
29 1
2 
34 1
2 
26 1
2 
32 1
2 
32 1
2 
36 1
2 
23 1
2 
30 1
2 
36 1
2 
25 1
2 
35 1
2 
25 1
2 
24 1
2 
33 1
2 
36 1
2 
31 1
2 
27 1
2 
28 1
2 
30 1
2 
30 1
2 
27 1...

result:

ok 3000 numbers

Test #13:

score: 0
Accepted
time: 2ms
memory: 3628kb

input:

1000
858601321232274393
727878911851691218
583242038528811547
913861254567301620
999722261383241879
840534758318805974
890099741981224430
545700118143787583
897924688692838177
555450273680017624
889375809227109526
756081351453538567
806229072658009773
542770292559337006
454941972865086783
8168811479...

output:

26 1
2 
31 1
2 
34 1
2 
27 1
2 
26 1
2 
27 1
2 
23 1
2 
21 1
2 
27 1
2 
28 1
2 
29 1
2 
23 1
2 
28 1
2 
32 1
2 
30 1
2 
33 1
2 
29 1
2 
31 1
2 
20 1
2 
22 1
2 
36 1
2 
31 1
2 
29 1
2 
26 1
2 
27 1
2 
33 1
2 
30 1
2 
28 1
2 
37 1
2 
32 1
2 
27 1
2 
32 1
2 
25 1
2 
27 1
2 
24 1
2 
22 1
2 
35 1
2 
35 1...

result:

ok 3000 numbers

Test #14:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

1000
525615733852422174
841019866366798731
520306019750685926
990050650589615474
827191793108327881
955320111031900193
638997447706873492
958266713872534605
674046160585138046
931689067447536844
824949899696619803
529160068002880860
741841535319953205
947164438820396022
512031089662714094
7044362717...

output:

33 1
2 
22 1
2 
24 1
2 
27 1
2 
26 1
2 
31 1
2 
31 1
2 
30 1
2 
25 1
2 
34 1
2 
33 1
2 
27 1
2 
33 1
2 
29 1
2 
31 1
2 
26 1
2 
37 1
2 
27 1
2 
28 1
2 
30 1
2 
26 1
2 
35 1
2 
27 1
2 
28 1
2 
31 1
2 
31 1
2 
31 1
2 
31 1
2 
31 1
2 
26 1
2 
31 1
2 
30 1
2 
32 1
2 
24 1
2 
26 1
2 
28 1
2 
29 1
2 
31 1...

result:

ok 3000 numbers

Test #15:

score: 0
Accepted
time: 2ms
memory: 3860kb

input:

1000
792630146472569957
754160816586938948
657370005267527598
866240046611929326
631289283683670795
670105468039961706
611267185992331048
970833313896248925
650167632477437915
907927861215056060
783896027020905867
702238788847190451
677453993686929341
774930626231198123
792492251905051786
6052304553...

output:

22 1
2 
33 1
2 
24 1
2 
33 1
2 
35 1
2 
31 1
2 
29 1
2 
26 1
2 
31 1
2 
31 1
2 
29 1
2 
26 1
2 
29 1
2 
31 1
2 
29 1
2 
28 1
2 
32 1
2 
25 1
2 
26 1
2 
27 1
2 
34 1
2 
31 1
2 
24 1
2 
27 1
2 
29 1
2 
31 1
2 
30 1
2 
27 1
2 
24 1
2 
33 1
2 
31 1
2 
31 1
2 
34 1
2 
30 1
2 
30 1
2 
33 1
2 
29 1
2 
29 1...

result:

ok 3000 numbers

Test #16:

score: 0
Accepted
time: 2ms
memory: 3816kb

input:

1000
983016595947493522
990673807956822242
994433986489401970
842429438339275879
935386774259013712
884890820753055923
883536928572755895
806771955069706324
826289112959672377
860794622422766788
919470121785383441
975317505396532749
702696809347032922
849581372997646397
806024638905570225
7433556794...

output:

36 1
2 
29 1
2 
32 1
2 
29 1
2 
31 1
2 
28 1
2 
29 1
2 
33 1
2 
30 1
2 
31 1
2 
34 1
2 
36 1
2 
30 1
2 
32 1
2 
27 1
2 
31 1
2 
28 1
2 
25 1
2 
36 1
2 
31 1
2 
32 1
2 
24 1
2 
25 1
2 
29 1
2 
28 1
2 
31 1
2 
29 1
2 
33 1
2 
37 1
2 
37 1
2 
23 1
2 
32 1
2 
28 1
2 
28 1
2 
24 1
2 
30 1
2 
30 1
2 
32 1...

result:

ok 3000 numbers

Test #17:

score: 0
Accepted
time: 2ms
memory: 3684kb

input:

1000
950031004272674007
803814766766897046
908125935151467863
818618830066622424
839484269129323929
899676173466150133
932434638593372261
819338555093420647
802410584851972244
837033416190285996
878416244814702193
871768263095618110
972050955865591970
807090959903059244
930042530945016779
8068188181...

output:

29 1
2 
28 1
2 
32 1
2 
29 1
2 
22 1
2 
30 1
2 
34 1
2 
34 1
2 
34 1
2 
27 1
2 
30 1
2 
35 1
2 
27 1
2 
25 1
2 
29 1
2 
30 1
2 
25 1
2 
23 1
2 
30 1
2 
35 1
2 
22 1
2 
35 1
2 
37 1
2 
22 1
2 
35 1
2 
33 1
2 
28 1
2 
26 1
2 
31 1
2 
25 1
2 
23 1
2 
29 1
2 
30 1
2 
32 1
2 
25 1
2 
35 1
2 
33 1
2 
31 1...

result:

ok 3001 numbers

Test #18:

score: 0
Accepted
time: 2ms
memory: 3892kb

input:

1000
917045416892821794
916955721282004552
945189916373342221
994808226088936235
966953800854409879
914461530474211617
904704376878829784
955277191971910709
978532056744272107
913272209957805169
913990335284212463
944846979644960393
907663418527535358
934857147313861324
987131652037611393
9076130060...

output:

24 1
2 
29 1
2 
27 1
2 
26 1
2 
28 1
2 
30 1
2 
32 1
2 
31 1
2 
30 1
2 
30 1
2 
27 1
2 
30 1
2 
28 1
2 
28 1
2 
27 1
2 
29 1
2 
28 1
2 
31 1
2 
30 1
2 
36 1
2 
32 1
2 
35 1
2 
34 1
2 
24 1
2 
30 1
2 
20 1
2 
28 1
2 
33 1
2 
30 1
2 
23 1
2 
33 1
2 
31 1
2 
27 1
2 
34 1
2 
30 1
2 
34 1
2 
26 1
2 
23 1...

result:

ok 3001 numbers

Test #19:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

1000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
100000000000000...

output:

36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1...

result:

ok 3000 numbers

Test #20:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

1000
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
1676083...

output:

1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 ...

result:

ok 21000 numbers

Test #21:

score: 0
Accepted
time: 38ms
memory: 3688kb

input:

1000
16760831
16760830
16760830
16760830
16760831
16760830
16760831
16760830
16760830
16760831
16760830
16760831
16760830
16760831
16760830
16760830
16760831
16760831
16760831
16760831
16760830
16760830
16760831
16760831
16760830
16760831
16760831
16760830
16760830
16760830
16760830
16760831
1676083...

output:

1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
2 2
2 10 
2 2
2 10 
2 2
2 10 
1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
2 2
2 10 
1 19
2 3 10 11 19 31 33 91 123 137 182 203 239 692 3691 4541 70129 882149 16760831
2 2
2 10 
2...

result:

ok 12636 numbers

Test #22:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

1000
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
524031
5...

output:

1 14
2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
1 14
2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
1 14
2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
1 14
2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
1 14
2 3 6 10 15 19 37 111 119 126 4721 14163 174677 524031
...

result:

ok 16000 numbers

Test #23:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
262111
2...

output:

1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8
2 3 12 19 181 209 362 262111
1 8...

result:

ok 10000 numbers

Test #24:

score: -100
Time Limit Exceeded

input:

1000
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
432345529851052031
4323455298...

output:


result: