QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#794555#9798. Safety Firstucup-team087#AC ✓1563ms19732kbC++144.4kb2024-11-30 14:54:222024-11-30 14:54:23

Judging History

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

  • [2024-11-30 14:54:23]
  • 评测
  • 测评结果:AC
  • 用时:1563ms
  • 内存:19732kb
  • [2024-11-30 14:54:22]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#pragma GCC target("avx2")

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")

////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;


constexpr int LIM = 2010;
Mint f[LIM][LIM];

int main() {
  for (int a = LIM; --a >= 1; ) {
    f[1][a] += 1;
    // /= (1 - x - x y^a)
    for (int n = 0; n + 1 < LIM; ++n) {
      for (int m = 0; m < LIM; ++m) f[n + 1][m] += f[n][m];
      for (int m = 0; m < LIM - a; ++m) f[n + 1][m + a] += f[n][m];
    }
  }
  
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    int N, M;
    scanf("%d%d", &N, &M);
    printf("%u\n", f[N][M].x);
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 1507ms
memory: 19544kb

input:

3
1 3
2 3
3 3

output:

1
4
10

result:

ok 3 number(s): "1 4 10"

Test #2:

score: 0
Accepted
time: 1502ms
memory: 19660kb

input:

1
2000 2000

output:

204576309

result:

ok 1 number(s): "204576309"

Test #3:

score: 0
Accepted
time: 1506ms
memory: 19676kb

input:

100000
10 1752
19 171
17 1105
14 687
28 204
3 1215
19 1610
30 764
6 537
42 656
41 943
36 795
28 795
9 740
28 1138
20 173
6 1160
21 1409
18 851
28 301
30 782
4 685
10 1792
15 868
42 1341
10 1361
4 1278
28 61
30 1943
44 1199
23 1398
25 1199
34 951
14 866
4 1469
4 1060
30 567
22 1805
50 1566
39 537
25 ...

output:

268773463
258398110
748990072
944261206
28848324
1415323
440426423
133920075
975812871
422247730
443385987
269602349
516611815
864790546
323341799
910043327
459119274
782783928
662557529
928314001
831289605
119493832
694722015
789549109
307680352
415179306
774755603
202375583
226239893
400583167
282...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 1517ms
memory: 19688kb

input:

100000
98 437
75 1936
82 522
51 1166
67 1452
96 618
96 1436
91 1173
100 1242
69 1280
74 125
73 869
77 811
73 1694
56 1550
65 1857
75 941
79 538
68 1057
71 907
90 1925
86 785
65 1658
60 1044
67 804
56 1428
53 127
97 197
57 680
81 1636
64 1200
79 790
92 1389
91 340
78 411
58 1308
70 952
90 85
91 1397
...

output:

742593766
791182960
260925178
423870975
954765117
233028625
298697835
166927245
254797666
165773109
608132753
508968899
726675390
951161570
757337043
102586936
115466851
787049646
41560035
882840713
26484816
898027489
538836045
445749214
446547003
117114483
182473853
404451392
352694143
378208316
32...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 1563ms
memory: 19544kb

input:

100000
129 1388
106 1862
143 434
143 681
126 1765
109 1644
144 123
142 1142
138 973
124 1795
121 973
131 392
147 1656
132 207
112 1853
126 1122
120 1251
103 1925
142 1140
115 1297
129 132
125 1533
126 1227
142 7
102 1513
133 858
149 1762
134 1855
141 1217
123 977
122 1460
129 1541
108 183
104 533
12...

output:

440317711
139768075
565993626
901858704
349245942
647922261
533399827
724222147
877395158
917502675
325080714
245930347
299162783
345803447
367132017
623799987
636190810
118577120
325019366
243129164
269236125
558129393
787577029
336286916
717132852
881434705
601429865
126037636
341589865
889242064
...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 1551ms
memory: 19548kb

input:

100000
161 204
198 236
164 128
170 67
178 1767
166 1558
161 1092
177 35
196 484
186 1852
186 1771
197 1642
196 547
163 454
190 538
170 427
198 243
153 24
154 376
158 1944
192 1612
168 1857
167 576
179 879
167 1792
151 1796
155 1548
185 413
169 1174
154 147
168 823
175 1886
184 1468
184 1436
182 1848...

output:

172213650
39226856
245140705
351049088
622302277
619509932
83846312
413497682
488845784
643322899
291252918
392636859
317943186
240120915
942222009
859975525
946587026
684244937
63714812
701449725
307104716
656890895
639328477
649490103
388256744
77822051
439206921
229542510
781413486
353732575
2507...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 1539ms
memory: 19672kb

input:

100000
249 1689
202 290
201 1758
205 1974
224 859
225 1404
237 1225
233 1537
229 1855
208 1514
225 427
236 1163
221 1767
205 1090
210 1747
212 1595
238 1397
222 474
208 797
238 865
202 454
241 762
242 825
202 476
225 1651
249 1402
238 55
232 1492
246 1425
209 44
247 1195
233 839
220 132
229 1720
219...

output:

478896065
389378364
985754036
339457290
317564442
238034798
309343251
975492930
113847787
837055938
639686562
389971277
427781065
524689817
271482752
29043143
758402389
480502530
280382698
778767560
786854567
692046693
274827770
691633514
548570489
980915638
703593445
290234486
159460105
825773786
5...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 1521ms
memory: 19544kb

input:

100000
284 484
280 887
281 706
288 982
265 139
252 1771
274 1693
265 1178
291 1816
274 1399
262 1735
256 382
298 1727
263 1573
275 1158
269 1148
295 1855
271 1846
299 1930
265 1066
282 5
263 689
263 319
300 184
290 1799
269 346
286 1413
258 107
276 968
290 695
264 1089
300 565
289 12
278 9
270 1341
...

output:

788345977
153327425
175203272
175973972
433579709
28443509
542941637
125034554
288677440
651395165
539742635
446883576
893484563
386570008
821704436
986842055
405743220
214946204
772942087
172320952
317542644
994457259
905260561
720455208
19612908
936949071
878179138
725633300
680798312
429632808
56...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 1527ms
memory: 19548kb

input:

100000
335 1149
328 420
314 908
333 457
311 436
343 1633
347 482
342 636
344 773
328 106
326 1956
324 142
332 1592
308 422
313 1269
339 1175
308 1239
341 1086
324 228
330 278
309 591
324 674
319 1371
329 771
340 1794
328 62
330 595
301 1963
350 1489
303 1316
350 229
302 498
310 1119
301 1314
309 158...

output:

466829660
555532898
409746105
578569521
769440372
2964768
307023301
191386338
94476448
18774209
725183049
726204726
156444031
615404413
971836582
153240471
350605612
950904415
519251422
190842679
334593063
535831679
579194005
162554264
940105611
595871343
892799212
631565608
490043538
188581175
9801...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 1516ms
memory: 19676kb

input:

100000
376 1267
354 1825
386 1074
382 1921
394 370
360 1456
357 665
380 1018
395 1137
363 1208
364 721
365 1070
390 448
370 1980
390 1392
371 1083
366 492
357 763
357 1432
361 822
397 1116
394 1002
358 1840
389 1723
360 1330
387 307
373 1123
369 159
383 176
382 1602
365 51
381 663
377 289
371 996
35...

output:

390253031
316787247
26462866
796298428
226183959
763080011
285937268
348142933
663866612
415181296
717569775
588413734
431000914
620523197
629378051
519455457
158359587
849533799
841515711
15339270
65428008
987517355
724009665
338388777
835526477
302484643
683704214
367172103
190625812
896253381
293...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 1537ms
memory: 19660kb

input:

100000
434 588
432 815
450 1418
412 1884
433 126
439 77
412 388
423 631
410 1014
442 1022
434 993
440 42
420 1227
446 560
416 831
439 982
440 962
441 654
446 1892
440 1320
406 221
405 699
429 466
434 267
412 842
438 1240
433 22
441 1013
446 403
402 1197
421 365
436 209
404 1964
431 1905
425 1185
437...

output:

207541749
336833274
881422547
827346611
70971321
454257920
154139314
510981588
13377934
490870112
444424948
139517186
593785414
304008128
991806197
789860487
200104450
171438083
200400903
729206302
3269775
136654208
154480081
965938881
33796074
153387776
855734088
872836628
335883197
509629206
68803...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 1547ms
memory: 19580kb

input:

100000
498 1140
453 628
461 1049
451 1076
486 307
498 1969
467 1281
487 742
480 168
472 1373
464 165
482 446
474 1321
453 740
454 503
464 1350
484 1921
492 1533
485 1466
458 655
463 1842
455 1654
463 1946
469 1670
466 877
492 574
452 914
472 1438
470 39
483 1514
456 160
483 678
465 253
500 1083
456 ...

output:

565577857
194207901
707193298
613954291
230290622
304782069
404818548
543201352
746901819
617211749
71591506
922305993
198339187
194403017
493251415
109494570
425648759
399865843
119104127
611830721
102201541
506278480
882381710
307917236
224024569
137492356
145220138
582902017
71781896
82649438
759...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 1528ms
memory: 19548kb

input:

100000
549 972
542 743
504 327
540 1176
507 1823
536 1613
542 1566
507 775
548 484
515 601
519 1984
549 951
544 1948
504 478
510 1621
524 1856
538 1540
542 1361
530 1243
528 779
507 839
525 404
511 888
537 14
538 725
509 1839
526 1604
545 89
547 1749
537 1847
520 1976
526 1730
507 114
538 1140
522 1...

output:

853927693
490442688
983465
576083671
659822629
619863844
636908261
485043933
3083678
248131385
958597481
2762630
756548542
514131507
679677683
781924009
40277939
936178970
881756007
391802886
410564977
340227570
530588833
451614191
731358456
645856448
993622086
431164470
465717764
351316769
14448812...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 1530ms
memory: 19552kb

input:

100000
573 442
593 728
581 505
590 733
578 166
589 1303
600 1802
571 209
588 57
571 1769
564 163
573 409
586 1080
568 1576
551 473
556 604
572 1889
558 1591
589 339
557 651
571 589
559 1702
575 1763
568 563
562 1719
567 1389
598 511
593 1904
589 276
579 1226
581 628
574 565
588 334
551 1785
578 764
...

output:

99077274
522659677
637226308
46626761
857324147
89267749
495554380
515629821
243315890
252005948
573178624
748014828
241822875
662216421
665934601
195474088
386576078
90444085
198849790
200441654
275054919
621111880
483697440
115734508
68469967
340627937
922800819
68301169
146052045
710594196
804292...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 1551ms
memory: 19688kb

input:

100000
645 1011
607 253
612 829
606 897
640 1486
602 1881
638 1619
609 1345
608 360
635 238
646 1532
641 381
639 1663
619 1605
630 188
641 1965
641 932
627 666
618 1067
610 685
648 279
611 1751
647 1119
607 165
627 1886
645 1056
626 1598
643 698
621 1514
629 76
647 1565
634 1654
620 789
610 1003
630...

output:

124662528
791615433
993225269
757234267
995532619
714629557
522983538
748624041
199793542
210263082
115938253
414380531
171523542
372892904
199537887
874898832
533233397
723915070
305346390
334866310
703982765
741493072
759811289
410785494
529124058
657959234
369669885
416203230
818074530
541654816
...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 1512ms
memory: 19620kb

input:

100000
699 1576
656 1644
683 798
688 1325
679 1104
683 1328
685 39
687 1279
661 1580
690 957
675 363
685 775
667 246
673 1246
672 789
662 1996
672 211
671 566
679 335
672 1782
696 1297
674 725
653 105
688 552
694 513
673 1888
671 1259
660 1013
687 1335
665 123
675 380
697 368
673 1875
693 1327
654 9...

output:

143623270
464492173
742231645
512838935
798690079
660053710
547812549
450247244
662675829
759568741
519584733
584316440
475020516
504493510
972310843
754179964
399392191
984787346
168196488
411977689
44606375
147280090
48125180
495280238
175438497
253751785
731664098
144559079
250307692
453139267
38...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 1540ms
memory: 19584kb

input:

100000
712 817
723 1333
707 1938
749 1029
715 1837
745 1660
706 1091
714 415
709 1905
743 338
714 83
734 1610
734 387
715 1812
740 1567
720 10
712 52
703 1905
713 638
703 785
737 1312
731 377
742 1747
728 949
720 1176
734 1149
701 1192
701 1792
720 812
739 177
726 993
738 1782
738 928
743 556
747 11...

output:

459745557
875178230
211505910
730033866
801999365
325746665
531736636
769259541
482967992
235329161
949635220
429625389
937596023
933987171
339525147
172537712
784807954
770046868
556802656
464114719
630169284
744503877
963099977
365161198
886244468
625906965
666495874
208968447
299966368
171145892
...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 1529ms
memory: 19724kb

input:

100000
791 1612
767 792
786 1906
783 788
775 528
767 391
762 1943
757 381
754 503
762 1186
784 1574
794 306
759 464
755 1595
784 819
777 1035
799 514
752 384
771 312
797 519
791 1547
774 713
781 803
766 78
787 1144
792 1267
766 995
770 563
764 1611
755 1995
757 1151
756 1319
767 1365
757 497
780 123...

output:

558418719
583057420
248911186
258765712
677473383
64237024
990876871
722204999
806069338
599263518
366185780
777177681
855459659
158004236
900280477
390130312
969071436
806555911
342141077
183774585
827991941
899572162
474961873
208120531
767918372
10935657
683088179
10238474
973824810
459738817
706...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 1506ms
memory: 19676kb

input:

100000
824 303
804 76
844 1684
806 472
834 341
822 70
850 1184
801 301
809 179
823 1367
810 593
818 449
820 266
826 1648
810 951
830 1450
802 164
841 1215
841 1088
802 1655
849 970
838 1852
836 1450
837 235
833 1635
829 1504
820 505
838 719
811 1713
842 1218
809 1594
847 560
801 1406
809 713
812 106...

output:

450794001
616500561
880935255
74974828
895518205
259093065
408112349
179204818
27408566
768467356
100132983
162115540
802571222
787938339
204885108
635902622
615750723
262996760
971405752
684954121
705901189
658211802
87730496
761002765
505550598
982296533
113320601
383465069
850910536
948805190
705...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 1519ms
memory: 19680kb

input:

100000
879 1430
881 1992
856 360
890 46
877 210
863 78
851 1594
867 1252
891 1244
874 1734
867 173
874 1360
876 542
878 381
884 984
868 1776
897 1494
861 1635
885 151
897 1615
893 430
900 1483
855 1000
890 66
861 170
875 546
855 1531
856 366
879 1143
856 1771
863 1066
899 1260
874 1618
882 863
884 9...

output:

764462574
630102451
686804163
42703869
364259034
101046287
155482879
440978341
609956529
689759496
701844646
930586220
693462494
726961526
634600429
856136887
579400751
540999912
320307158
104948786
644315873
979535462
772456657
379511903
341668715
776790686
683452212
208117616
194410406
908590360
6...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 1512ms
memory: 19676kb

input:

100000
944 1290
942 1602
911 1168
916 1153
939 1738
947 1712
902 1083
949 139
949 1869
906 1910
901 1843
909 1096
906 289
912 549
915 1097
914 1339
945 1929
945 531
905 49
924 391
910 1571
930 1776
914 1944
935 1471
947 1154
944 1429
901 1171
939 756
919 1843
935 82
921 1439
931 773
929 663
922 641
...

output:

638467682
303146295
556982743
699223995
518848426
670687065
669768330
513655598
569658996
468364894
651539305
787352982
168125519
34195973
489696371
92551380
521101739
977309599
829038488
992868156
685630333
598840906
477017818
327276271
102206280
755386432
543353924
207117677
767091988
93502063
379...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 1520ms
memory: 19668kb

input:

100000
959 1048
956 1155
996 184
979 1233
955 1354
952 1348
987 1492
958 1084
955 237
954 1376
958 321
973 676
977 140
958 1387
958 714
974 627
992 1336
961 1868
992 1043
999 1909
953 692
978 479
964 1738
962 1013
961 481
973 1887
983 467
992 1054
960 1403
970 942
963 828
960 1044
984 1425
961 298
9...

output:

948454275
910456130
160715477
218910049
664282173
652402680
722326238
376612278
411457797
846444125
526075446
798598616
68932209
908855480
585634744
569292364
356239516
490538463
58125043
653558094
974701185
39026635
967692502
587293586
398803364
375431687
296970111
668704006
190538780
159239191
303...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 1516ms
memory: 19612kb

input:

100000
1036 447
1018 1772
1003 1854
1033 1347
1001 674
1016 1981
1012 1443
1050 1193
1020 120
1015 1662
1015 41
1017 1211
1013 1289
1016 1952
1020 1220
1014 1278
1036 361
1041 536
1029 243
1038 14
1023 1961
1029 1565
1035 602
1004 310
1042 1724
1021 460
1034 1039
1005 1687
1027 943
1006 583
1009 682...

output:

735443234
128706568
946472364
104137427
723191264
736423008
653606840
723966055
361817111
425929850
971620165
174128569
192426403
85369460
861041728
914256809
632056716
136020642
242949360
179637702
837540542
656425602
323844545
279794640
901312553
250630631
756508985
927357421
900720489
603312742
6...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 1541ms
memory: 19604kb

input:

100000
1094 353
1065 1235
1093 410
1082 1463
1062 389
1097 965
1062 1186
1062 2000
1075 1591
1078 404
1059 286
1056 1071
1097 346
1079 57
1076 907
1063 1158
1076 1571
1059 34
1075 496
1054 1497
1073 556
1056 1217
1087 1339
1092 1454
1079 1539
1061 715
1051 594
1057 1099
1051 1787
1051 1006
1066 453
...

output:

30967448
878314440
407785873
663874709
645559603
358365149
263330164
138968400
815472461
13756947
557172666
942848906
540639314
994081323
195228774
516896462
680785734
384115870
922228505
97723675
849576083
869430885
934809671
542529425
914146321
220239213
512289922
415504849
344965767
805414599
810...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 1510ms
memory: 19680kb

input:

100000
1114 1098
1108 1829
1131 660
1147 1958
1127 1106
1146 107
1123 893
1107 600
1146 618
1128 1819
1139 1868
1111 255
1111 1527
1120 562
1102 698
1128 1714
1106 370
1113 769
1106 534
1108 698
1108 1246
1110 1616
1119 870
1145 696
1147 249
1124 1456
1105 643
1119 1310
1122 151
1149 1912
1123 516
1...

output:

450583619
47182405
277190350
331785711
34563079
302884550
596744026
25413858
712849050
974180005
809489875
622453761
396306475
610922979
750763010
639457911
978371982
762991858
96303525
996178264
367452028
889822497
521558718
928088036
906389382
99846853
687670328
571967218
217061248
794425634
49223...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 1520ms
memory: 19588kb

input:

100000
1151 204
1192 1774
1192 1468
1186 1789
1173 176
1151 819
1192 1036
1196 783
1152 614
1172 905
1177 932
1174 1807
1171 1521
1175 1547
1178 722
1182 1469
1194 1950
1151 1113
1160 1796
1156 609
1196 108
1181 794
1197 1338
1177 583
1174 1053
1162 1483
1185 504
1161 600
1158 1038
1193 1839
1194 55...

output:

12766052
793618629
793229721
294150805
372849781
777759574
26608380
527384668
952796115
965374013
469484556
749648407
149211414
364110805
847383755
396140778
213489175
857895128
445800766
426932186
627762459
543789876
864206371
27970728
499674961
334033993
892514802
149204421
923559097
22912216
4716...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 1510ms
memory: 19616kb

input:

100000
1244 1014
1246 1348
1207 732
1226 1425
1225 999
1237 788
1211 15
1218 518
1235 1684
1238 1409
1235 973
1222 1695
1220 1264
1225 500
1226 1309
1207 1868
1241 245
1226 497
1235 857
1249 741
1236 45
1221 61
1240 1223
1249 127
1212 1999
1226 1693
1224 831
1229 1325
1210 1097
1207 1357
1243 1609
1...

output:

111444254
907890766
363032050
19975553
570476296
149680699
179650811
199972720
508043909
90051029
94057739
102678902
209366384
396482414
480316024
783955318
997591960
981838264
137604843
680258098
727445053
606460435
192729255
894866365
596417941
366462542
140472814
284490290
687264983
951693320
878...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 1511ms
memory: 19524kb

input:

100000
1264 137
1266 890
1275 185
1258 903
1288 1653
1258 1981
1263 732
1275 610
1289 1783
1300 1026
1291 1406
1267 857
1254 1759
1299 991
1283 980
1299 809
1263 1565
1268 1301
1271 359
1255 727
1287 1749
1255 194
1265 802
1270 193
1279 140
1300 1845
1269 1954
1260 1628
1274 575
1297 1775
1260 803
1...

output:

301918181
674210712
268657471
166642439
78057258
916518154
750601883
715776766
327545971
434161599
666974520
446251336
536250414
58559378
198270041
674367254
555951939
878900083
614812543
555146927
498104712
882232910
120163896
400420503
473159919
413199132
479669309
76365632
172259179
6077868
13870...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 1503ms
memory: 19544kb

input:

100000
1341 1479
1315 192
1339 679
1321 141
1324 1922
1345 1556
1309 392
1346 1972
1342 849
1326 1490
1348 214
1316 673
1320 1651
1345 1835
1304 317
1301 730
1332 688
1341 1766
1322 77
1307 1293
1322 1383
1341 1988
1319 1306
1337 1881
1325 1119
1323 1709
1314 155
1335 679
1341 937
1304 1371
1302 324...

output:

252659001
813600735
294763383
67729717
907575453
859706080
840010520
316037130
938687983
300734729
349241479
434877276
744756716
674657932
457632653
435430472
225219815
54749124
452369505
230498935
523546802
334953756
465293844
460159226
634705278
79698004
959821848
534883029
286364892
255512537
933...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 1514ms
memory: 19656kb

input:

100000
1371 1186
1351 1578
1379 324
1381 254
1356 589
1380 765
1366 92
1360 18
1380 874
1392 375
1373 1690
1355 643
1381 1089
1376 1434
1365 566
1359 307
1370 1501
1364 183
1393 462
1352 207
1369 1398
1384 885
1372 1966
1397 881
1398 992
1365 478
1382 6
1379 1639
1365 1810
1371 1006
1383 208
1359 18...

output:

905380217
736670222
185362352
121179481
244544873
865722168
808360727
238899974
270741501
965691127
489894095
375454834
905339686
531970077
697835869
143221267
885361063
443713972
89997338
345349957
182005220
886673124
75327682
275014861
782258430
745132749
703207615
895977619
258837443
103639555
90...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 1498ms
memory: 19720kb

input:

100000
1437 447
1404 901
1417 201
1432 344
1420 264
1423 1543
1402 241
1437 142
1404 1067
1430 916
1417 1180
1440 1597
1430 1215
1427 1731
1427 1300
1428 1608
1419 74
1404 1603
1417 1096
1450 1378
1425 181
1438 1440
1408 1007
1409 1577
1444 1282
1449 1093
1438 1719
1434 67
1403 1023
1410 934
1405 11...

output:

120626257
717901138
212672011
933200326
348979224
878573381
406448870
773137689
357195358
750288986
258483057
708538547
3318790
681938607
309509373
543764585
233630234
19404268
953223288
148465010
951787251
300959083
214452034
193965552
331249560
920716439
314829636
282980058
991752678
64217931
1101...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 1521ms
memory: 19636kb

input:

100000
1472 238
1466 1744
1495 1748
1466 1592
1493 621
1493 935
1489 693
1464 100
1464 1062
1486 1534
1492 1789
1499 1041
1458 1622
1486 542
1498 995
1496 645
1494 231
1473 1671
1455 204
1459 667
1496 999
1477 1250
1455 1014
1479 1317
1472 914
1453 749
1479 1521
1500 1093
1460 367
1465 823
1483 371
...

output:

854855304
879638981
157299159
990251171
85650796
351832397
127022091
921516623
60778116
881236305
385683434
425834887
910171412
179034321
796303096
465199516
536928832
488027224
901143697
872466159
847357085
290656843
259726148
22487519
73720779
195157382
401206623
155913349
300403915
737168919
9878...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 1534ms
memory: 19588kb

input:

100000
1515 1098
1527 1128
1507 401
1540 360
1538 802
1548 1957
1520 1447
1526 1745
1516 1775
1511 376
1507 1014
1502 686
1532 335
1508 1077
1502 885
1545 267
1502 1408
1544 1598
1515 878
1519 499
1523 1027
1541 36
1531 1597
1537 754
1545 677
1521 1633
1521 258
1538 1255
1511 812
1527 1501
1524 1549...

output:

64398553
346211218
426303525
609574356
537291161
346298646
452338833
632441642
300430580
264555624
740992622
86868563
352399946
480976745
46391288
420988452
463286992
752748936
329587443
170423687
832083407
918171527
212473007
203006560
434631354
34924226
971843960
37047728
528847466
246199103
19584...

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 1527ms
memory: 19676kb

input:

100000
1565 1244
1566 1121
1598 1634
1588 502
1600 1287
1582 1259
1582 1491
1586 944
1575 1989
1579 1573
1560 464
1551 335
1566 641
1556 1257
1562 1528
1584 268
1592 326
1580 1587
1599 551
1562 1554
1557 708
1559 443
1563 1331
1576 1264
1553 39
1574 1649
1553 666
1596 419
1561 1260
1567 1343
1564 26...

output:

662184178
30783209
551058432
393714414
854633410
262679017
357386531
222469798
708860282
895783948
339548091
658466616
517527655
268132119
960900641
211187150
427380016
648909070
777226963
516851654
555382588
750074405
740120040
404660243
940389662
761240811
893374681
473838930
692545324
120430384
8...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 1529ms
memory: 19560kb

input:

100000
1611 841
1613 1257
1630 73
1628 1689
1641 1978
1648 1532
1615 1113
1612 711
1629 103
1639 1738
1630 220
1636 1761
1645 1555
1610 203
1608 597
1606 467
1604 1057
1639 799
1644 1151
1639 816
1645 168
1625 783
1601 930
1608 397
1612 1661
1629 570
1640 1850
1639 1309
1648 790
1637 642
1649 1994
1...

output:

466981868
971115889
455094383
508161876
888985911
448610469
850413817
420960258
761412441
514169094
958880131
151834994
294387549
153870377
130945878
619768160
226677525
268821601
362582801
580664406
147054582
556985361
388778933
982368871
543925893
798810247
945567167
535745344
798539625
779591522
...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 1527ms
memory: 19692kb

input:

100000
1693 439
1689 992
1655 1787
1691 748
1678 721
1694 1729
1659 1306
1694 1108
1669 819
1659 155
1658 1654
1677 257
1653 711
1657 204
1695 1316
1669 1848
1685 124
1663 95
1687 363
1682 239
1653 388
1700 634
1671 1032
1674 1448
1658 40
1668 943
1667 1331
1667 1444
1651 1066
1672 296
1656 230
1665...

output:

820265631
824723768
496386255
512946807
795997812
165263575
549836694
706532481
191377639
524613173
183538397
9405646
219407052
698422661
830494787
512833411
469937514
983395112
499967350
160962099
185357506
244305652
275281640
482844590
146206226
892952515
4117592
618687150
510088754
491314100
8458...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 1516ms
memory: 19680kb

input:

100000
1742 1593
1712 466
1709 767
1715 1494
1734 7
1717 807
1732 663
1725 1626
1714 1557
1705 1562
1725 1555
1706 512
1728 322
1748 661
1748 1249
1710 929
1731 85
1739 1585
1730 610
1726 1505
1724 682
1746 1158
1714 425
1702 606
1719 329
1709 1067
1703 237
1721 834
1729 1491
1734 1986
1711 968
1744...

output:

661900541
730643061
737872701
802714334
892059635
868634583
191381364
40690419
945038786
892267075
802768261
615009149
695515132
266214883
152248099
309190354
596811043
323127508
66387994
588218365
733415875
784713251
421315865
393394377
362805661
242857784
82593721
38740787
387916187
198642602
2626...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 1525ms
memory: 19600kb

input:

100000
1782 1243
1774 1689
1766 1561
1779 911
1766 663
1751 639
1798 922
1792 40
1777 1034
1762 1889
1765 1901
1772 1514
1793 614
1754 1535
1789 429
1771 1182
1756 591
1786 1138
1762 84
1768 19
1799 1462
1783 31
1788 1896
1796 1238
1770 331
1756 1458
1783 1133
1796 763
1786 154
1772 80
1770 1692
178...

output:

715618766
267490877
910728798
484425821
296643310
11819023
880003400
530759032
511042212
801539954
728529197
966061728
132054465
179908852
804475365
773339601
259280126
416449953
489168509
457935171
981499923
853707232
721018332
132053782
953938889
619164241
62898854
752562059
495667182
358343892
49...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 1508ms
memory: 19688kb

input:

100000
1824 1099
1847 811
1814 1970
1805 81
1842 663
1827 1776
1849 252
1841 641
1847 880
1850 1514
1827 1794
1804 413
1812 1269
1807 1360
1829 860
1848 405
1819 412
1834 467
1839 286
1833 1575
1815 838
1825 208
1814 307
1820 110
1814 1154
1812 1967
1807 661
1805 1031
1838 499
1834 1922
1817 754
182...

output:

406842284
993494384
269370583
609085729
217925248
842745064
86352821
461662382
478666745
599996925
377384288
137630267
679926219
717139776
694552818
853712398
192619374
938217849
822475943
918069359
20301270
585965121
542175130
548898232
229615927
83303173
116495790
802291366
921522903
340244855
108...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 1506ms
memory: 19664kb

input:

100000
1878 817
1873 1321
1852 1217
1869 1148
1870 1383
1873 1162
1899 423
1864 929
1869 696
1873 1352
1863 628
1867 62
1874 916
1891 379
1896 688
1852 1863
1876 133
1871 1582
1875 1210
1861 264
1851 152
1890 1477
1877 1274
1881 233
1870 844
1874 1366
1858 1216
1886 40
1867 142
1873 396
1873 1488
18...

output:

819549991
479042744
918606625
672060192
361965874
996615691
495062700
945509271
541423426
912748397
145386575
308602782
517113424
320671815
408568386
596459071
230963812
524913070
367017845
222931979
721096302
397805759
98633568
997174235
746374084
49932774
273326453
166267196
573757913
376247017
29...

result:

ok 100000 numbers

Test #41:

score: 0
Accepted
time: 1512ms
memory: 19732kb

input:

100000
1944 108
1931 557
1941 1012
1918 87
1914 1197
1933 429
1909 221
1929 188
1913 1605
1926 91
1920 882
1908 1363
1926 475
1941 1061
1941 1431
1940 304
1937 152
1934 1146
1916 484
1936 1227
1908 441
1935 1664
1908 1344
1913 567
1927 409
1939 1284
1911 1775
1923 817
1921 1815
1913 513
1922 1308
19...

output:

374007545
941217230
204101044
339351748
162418654
437005031
802058779
724056659
581392235
47567213
655408765
768018695
602299599
31260895
267126346
493891951
73548559
258889924
459098418
875687723
290848824
609615761
109372062
177804889
470981183
850471953
245421511
959743011
925649019
530484721
953...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 1508ms
memory: 19596kb

input:

100000
1961 657
1968 258
1994 1869
1986 779
1986 1988
1960 1309
2000 1077
1996 1166
1992 1809
1996 719
1959 394
1999 1896
1992 761
1982 509
1993 493
1978 1797
1985 269
1999 900
1969 1891
1985 86
1958 290
1951 1918
1953 1054
1974 1321
1976 534
1989 279
1955 541
1962 449
1958 461
1989 853
1982 1477
19...

output:

865452977
958899698
820450654
576263913
706452943
603225166
900534855
363583619
664584428
728363066
550020854
379688217
85807660
848233720
44662856
943794937
74424794
577098493
543505639
936749723
317201863
645869997
181938170
264423005
578326
185025258
969267658
676445295
755627485
396852737
488241...

result:

ok 100000 numbers

Test #43:

score: 0
Accepted
time: 1503ms
memory: 19672kb

input:

100000
1290 1253
458 479
1909 1921
105 73
802 1859
973 1916
1612 1171
1505 697
114 1602
1572 1067
336 460
855 1337
413 1254
214 1401
1981 257
252 677
1903 1965
1403 1224
689 1196
1173 1335
1165 984
1264 578
1390 1705
719 93
1970 984
1516 1302
551 1390
1113 1944
1263 411
1856 1157
1730 1085
1521 1733...

output:

392355714
527857818
494196864
449792932
198322078
706504071
947347365
390387975
151120031
500624765
233430332
803477461
109649193
453482266
646531352
539062867
153266497
310589322
860206831
399332017
789553756
537275042
868182768
653763599
907482687
781238603
705575782
782213334
107658885
950148190
...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed