QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#462827#3101. Event Hopping 2nhuang6850 100ms16404kbC++203.2kb2024-07-04 06:31:292024-07-04 06:31:30

Judging History

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

  • [2024-07-04 06:31:30]
  • 评测
  • 测评结果:0
  • 用时:100ms
  • 内存:16404kb
  • [2024-07-04 06:31:29]
  • 提交

answer

/**
 * @file qoj3101-1.cpp
 * @author n685
 * @brief
 * @date 2024-07-03
 *
 *
 */
#include <bits/stdc++.h>

#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbgR(...) 4242
#define dbgP(...) 420
#define dbgRP(...) 420420
void nline() {}
void bar() {}
#endif

namespace rs = std::ranges;
namespace rv = std::views;

constexpr int MX = 100000;
constexpr int LG = std::__lg(2 * MX - 1);

template <class T> struct CC {
  std::vector<T> val;
  void insert(T a) { val.push_back(a); }
  void init() {
    std::sort(val.begin(), val.end());
    val.erase(std::unique(val.begin(), val.end()), val.end());
  }
  int operator[](T a) const {
    return static_cast<int>(std::distance(
        val.begin(), std::lower_bound(val.begin(), val.end(), a)));
  }
  int size() const { return static_cast<int>(val.size()); }
};

struct Event {
  int val, i, type;
};

int main() {
#ifndef LOCAL
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif

  int n, k;
  std::cin >> n >> k;
  ++n;
  ++k;

  std::vector<int> l(n), r(n);
  CC<int> cc;
  cc.insert(0);
  for (const int i : rv::iota(1, n)) {
    std::cin >> l[i] >> r[i];
    cc.insert(l[i]);
    cc.insert(r[i]);
  }
  cc.init();
  const int m = cc.size();
  for (int &i : l) {
    i = cc[i];
  }
  for (int &i : r) {
    i = cc[i];
  }
  std::vector lift(LG, std::vector<int>(n + 1, n));
  {
    std::vector<Event> ev;
    for (const int i : rv::iota(0, n)) {
      ev.emplace_back(l[i], i, 0);
      ev.emplace_back(r[i], i, 1);
    }
    std::ranges::sort(
        ev, std::greater<>(),
        [](const Event &e) -> std::pair<int, int> { return {e.val, e.type}; });
    int miR = m, mi = n;
    for (const auto &[val, i, type] : ev) {
      if (type == 0) {
        if (miR > r[i]) {
          miR = r[i];
          mi = i;
        }
      } else {
        lift[0][i] = mi;
      }
    }
    for (const int i : rv::iota(1, LG)) {
      for (const int j : rv::iota(0, n)) {
        lift[i][j] = lift[i - 1][lift[i - 1][j]];
      }
    }
  }
  auto count = [&](int i, int rb) -> int {
    int ans = 0;
    for (const int j : rv::iota(0, LG) | rv::reverse) {
      const int nxt = lift[j][i];
      if (nxt != n and r[nxt] <= rb) {
        ans or_eq (1 << j);
        i = nxt;
      }
    }
    return ans;
  };
  std::set<std::pair<int, int>> in;
  std::vector<int> ans;
  in.emplace(0, 0);
  int cnt = count(0, m) + 1;
  for (const int i : rv::iota(1, n)) {
    const auto it = in.lower_bound({r[i], 0});
    if ((it != in.end() and l[it->second] < r[i]) or
        std::prev(it)->first > l[i]) {
      continue;
    }
    const int rb = (it == in.end() ? m : l[it->second]),
              li = std::prev(it)->second;
    int lcnt = cnt - count(li, rb);
    lcnt += count(li, l[i]);
    lcnt += 1;
    lcnt += count(i, rb);
    if (lcnt >= k) {
      in.emplace(r[i], i);
      ans.push_back(i);
      cnt = lcnt;
    }
    if (std::ssize(in) >= k) {
      break;
    }
  }
  --k;
  if (std::ssize(ans) < k) {
    std::cout << "-1\n";
  } else {
    for (const int i : ans) {
      std::cout << i << '\n';
    }
  }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 7
Accepted
time: 0ms
memory: 3844kb

input:

1 1
1 3

output:

1

result:

ok single line: '1'

Test #2:

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

input:

2 1
2 4
3 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

3 1
2 5
3 5
4 7

output:

1

result:

ok single line: '1'

Test #4:

score: -7
Wrong Answer
time: 41ms
memory: 15656kb

input:

99999 93097
40044 40749
44538 45365
46530 47401
52845 53481
59519 60065
86226 87059
88353 88992
95665 96502
95669 96575
100446 100968
121870 122544
130836 131540
146294 147230
151177 151970
160381 161376
164174 165119
166582 167438
169062 169687
173200 173849
177329 178217
189213 189811
249372 25029...

output:

-1

result:

wrong answer 1st lines differ - expected: '1', found: '-1'

Subtask #2:

score: 0
Wrong Answer

Test #47:

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

input:

1 1
134842099 137944073

output:

1

result:

ok single line: '1'

Test #48:

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

input:

2 2
4015595 884953730
519508315 726912949

output:

-1

result:

ok single line: '-1'

Test #49:

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

input:

3 2
551691302 800582045
14063803 52897269
153641504 567834643

output:

1
2

result:

ok 2 lines

Test #50:

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

input:

18 3
157893686 958635898
790021767 976682032
534783017 706987897
216566011 510148270
288661613 856715472
81126924 420966670
9734253 823219818
77427078 241270378
182953794 928971032
65710916 937359407
159217847 343023570
266169092 635952191
94867522 407392584
298640819 490028599
281580042 514089998
6...

output:

2
3
4

result:

ok 3 lines

Test #51:

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

input:

19 3
345121760 363569961
369142474 697961114
204455374 777512357
278051598 780834857
119744682 610142516
112692534 284271720
530820418 613805256
666599238 970772442
684066330 747151742
52464000 153949333
361766230 921325388
34600363 168745634
119418778 738281466
828841976 976561834
257913352 2579536...

output:

1
2
6

result:

ok 3 lines

Test #52:

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

input:

20 3
226617517 417144410
401110226 504506272
204308913 972565478
100780114 930332684
473716139 730386187
327436800 871728821
662616072 881801440
469971234 769277127
437331467 913865677
641546412 700063729
82089639 830256714
384651823 502387376
558881974 905373190
468189379 998408858
9103683 60217281...

output:

1
7
18

result:

ok 3 lines

Test #53:

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

input:

20 5
715591101 817706977
777008847 930020190
379125190 717746290
308826535 651449374
799848635 899870053
173402733 393191194
565584335 789226348
291163241 758381981
249473019 374801668
294956234 880404922
451362750 913870571
98855617 246302398
339866606 382702111
293058132 409201146
478015003 708631...

output:

1
9
12
15
19

result:

ok 5 lines

Test #54:

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

input:

20 4
95564966 475651640
544140915 921414489
36636943 545028649
269212181 518161723
368415853 600482753
416749483 825099524
704848425 946709199
145082659 465308089
751497619 765279722
452763328 557958381
643817392 876292284
353226095 933184330
466610247 590597228
29324927 65589713
155598093 306733984...

output:

5
7
14
15

result:

ok 4 lines

Test #55:

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

input:

20 2
341059917 968468550
619575412 657744605
362725213 784431788
79002877 857963719
636336680 943339572
282572479 300370019
213849085 706084423
315706132 851874320
740367416 998763448
113510482 521411850
198080835 487564765
29193064 86493364
488295690 701227663
351650597 899167999
437802529 73566590...

output:

1
6

result:

ok 2 lines

Test #56:

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

input:

20 1
827468447 879951302
735432164 759558988
269959865 944012171
67243577 84278317
805433568 936534843
171608293 591686301
112362102 822334845
410116008 619648090
306041507 327894522
360193096 488922828
417005225 834550228
872712520 873151446
472785468 800113380
39268216 894210474
600856133 91169444...

output:

1

result:

ok single line: '1'

Test #57:

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

input:

20 9
18246520 289037312
223590378 904221984
158468076 685664873
661343077 978347160
435186112 640627800
559466880 559927584
45242916 566596015
130290765 300200349
175183463 434730463
75064355 595211002
333621902 449961207
28044312 78011568
267319532 981800089
579543582 623250773
501315035 549454467
...

output:

-1

result:

ok single line: '-1'

Test #58:

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

input:

20 4
282915225 425599000
46844071 877724908
331562754 774194013
454952275 729482745
26829711 957331160
627282472 841455868
100114358 781547255
150014807 274089000
534690006 980470663
541821180 599376720
84150518 232318480
4457533 168338098
28542916 343576455
94961278 964757965
1021672 802156769
1412...

output:

1
6
8
10

result:

ok 4 lines

Test #59:

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

input:

20 3
568423024 732950395
30698730 953476873
240194350 760469817
571506747 960258324
142530756 898809811
502816961 572446466
63299466 595327108
441383100 954106794
401449920 893452390
131382436 615911903
103318462 704161744
17001604 744184311
355982562 921938859
277739118 448466769
852604059 87135217...

output:

1
14
15

result:

ok 3 lines

Test #60:

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

input:

20 4
729581552 843936903
595777889 662269624
434082235 904888330
189209392 706890360
122057607 566242764
12655119 862773552
253295242 267145374
514009091 646726110
699170128 892329802
139765740 798881549
465088674 483212263
438274771 843531949
551372681 969365825
370571050 441985295
369851925 695022...

output:

1
2
7
11

result:

ok 4 lines

Test #61:

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

input:

20 3
52680030 171567270
562416436 932178589
180457200 874534710
57962547 619926504
514034951 735903893
569357027 949556658
96546655 769067522
156273105 550639233
102800728 342367246
341675981 994824681
12457939 294153271
13450385 307425366
90257349 383467364
29966544 411684432
69951674 186314264
223...

output:

-1

result:

ok single line: '-1'

Test #62:

score: -1
Wrong Answer
time: 0ms
memory: 3624kb

input:

20 9
18 22
2 5
28 31
21 25
25 27
3 6
36 39
22 26
8 12
27 31
27 29
32 36
14 18
16 20
22 26
10 14
17 21
13 17
15 19
37 40

output:

-1

result:

wrong answer 1st lines differ - expected: '2', found: '-1'

Subtask #3:

score: 0
Wrong Answer

Test #74:

score: 31
Accepted
time: 2ms
memory: 3732kb

input:

3000 57
226083340 261990234
392684356 462929590
468018811 841719892
495096853 606046097
196983814 256423598
331199122 967656486
802593662 931108452
74501453 679054962
294344294 752837262
295708332 547261648
265421699 652708933
272959087 727136240
165667761 846917534
61770748 157663302
608516043 8492...

output:

50
85
104
139
173
189
257
273
297
327
347
374
411
543
600
665
686
750
766
850
971
977
990
1040
1069
1074
1109
1183
1226
1231
1316
1440
1508
1597
1611
1670
1676
1774
1811
1822
1885
1968
2005
2103
2153
2271
2304
2416
2445
2562
2593
2608
2690
2798
2873
2884
2952

result:

ok 57 lines

Test #75:

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

input:

3000 52
515391161 611274809
241579177 794330740
10171859 421070901
191803444 462515964
789307312 942558211
168283015 749632607
741578406 748242944
727114778 888235899
285915154 538783207
740946890 927609854
511153062 526293212
202320202 315438522
60716314 641460650
4714115 322423665
680445730 761796...

output:

1
7
192
299
300
315
336
345
359
372
452
465
492
510
527
562
584
760
800
901
931
956
1075
1130
1170
1252
1281
1302
1363
1390
1427
1451
1474
1483
1555
1579
1635
1668
1788
1926
1971
2031
2052
2075
2121
2219
2226
2241
2421
2541
2682
2859

result:

ok 52 lines

Test #76:

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

input:

3000 50
164570698 977045956
184755663 365443392
603003602 688612912
69841518 845988325
124418966 495851703
92585079 221534905
66139125 492051425
11421559 470042732
353246878 519346251
394298743 656627500
91775697 487156113
216248411 680156936
102411138 118357679
310656407 421025471
226521211 7328919...

output:

2
13
31
63
71
73
107
171
204
212
235
242
282
315
338
363
385
498
513
533
597
602
741
1005
1366
1370
1400
1437
1453
1620
1631
1641
1660
1677
1753
2013
2052
2095
2188
2193
2208
2273
2384
2403
2532
2536
2540
2617
2727
2882

result:

ok 50 lines

Test #77:

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

input:

3000 26
420404814 607862506
424467321 435523425
441190777 977565387
171426323 268399128
98674944 937744436
65655455 205658000
102598650 388620400
594769046 940080999
63712781 445910235
378752716 930132171
428633245 659202337
232544464 994494247
6080714 60362625
221134868 345936051
808753899 83968712...

output:

1
4
13
15
26
27
30
42
81
105
114
149
301
558
806
822
843
904
1050
1169
1342
1373
1381
1930
2233
2421

result:

ok 26 lines

Test #78:

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

input:

3000 13
102826206 602027329
434931994 772339872
413413031 694464267
314395105 702742251
503992096 615714991
524571226 706613683
435807387 612902646
578112010 649125385
844903761 848000998
341521417 363587344
97482358 959069283
521677223 694511265
640709856 675605818
42442983 875334044
857624837 9646...

output:

1
9
13
15
43
152
165
309
333
547
977
1141
1657

result:

ok 13 lines

Test #79:

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

input:

3000 70
198876171 633452260
354684172 825494360
176550414 579846248
37743187 608475834
450639405 902539433
280219847 870211150
464249200 742260813
41925939 766325361
97120779 711013020
574107337 735065952
246344901 762902043
672906006 685387866
244479077 865874730
648084393 685613914
158950527 67355...

output:

-1

result:

ok single line: '-1'

Test #80:

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

input:

3000 61
288199641 988839430
555844621 886872865
528143584 789134190
562722637 879682817
56509608 381493312
229625999 946569378
54106433 199826523
26672970 471173920
182843886 848260651
146884261 191667110
696155489 947691429
228312645 368033961
423044046 764707825
271023642 485950519
153931729 96748...

output:

-1

result:

ok single line: '-1'

Test #81:

score: 0
Accepted
time: 3ms
memory: 4012kb

input:

3000 2931
717499499 717506267
392679825 392686341
694444934 694453409
780438871 780445478
338800501 338810163
932318897 932326372
571463112 571469934
657811272 657818137
853170401 853177063
980130048 980136614
470824555 470829577
586203411 586209503
56106755 56114626
830789358 830795307
790344400 79...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2931 lines

Test #82:

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

input:

3000 2628
241730947 241740288
658483880 658490240
807041193 807049477
842592817 842600016
987698454 987704778
731407174 731414105
645086761 645095059
384663701 384670491
782262851 782268893
459848253 459858000
274935402 274944725
825636713 825642267
436165777 436173314
875901828 875911426
878615751 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2628 lines

Test #83:

score: 0
Accepted
time: 3ms
memory: 4016kb

input:

3000 1960
367683881 367761448
215927495 215996140
123327945 123399581
517814503 517905591
445638988 445733217
474509686 474567834
835839513 835923838
196178279 196228647
716259021 716336050
686584694 686683895
703996530 704060207
160293571 160373918
589183152 589240014
582673713 582753879
332295166 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 1960 lines

Test #84:

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

input:

3000 2461
453531793 453621247
558539257 558594171
731739897 731806619
975060474 975133124
612632248 612702460
746803150 746876746
309037653 309111171
158550993 158628126
91959293 92023150
682539837 682632482
78195454 78293782
448833562 448893692
406764747 406838753
439840691 439925982
463920530 4639...

output:

-1

result:

ok single line: '-1'

Test #85:

score: 0
Accepted
time: 3ms
memory: 3952kb

input:

3000 2461
448202517 448273218
597685396 597738816
898391908 898487853
551203413 551292049
538903715 538967314
960936285 961004894
317177569 317272788
227411137 227497567
50871215 50945345
780540596 780598452
997296850 997387679
813579782 813657678
494940859 494999468
133765968 133849544
715564610 71...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
62
63
64
65
66
67
68
69
70
71
72
73
74
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
103
104
10...

result:

ok 2461 lines

Test #86:

score: 0
Accepted
time: 3ms
memory: 4016kb

input:

3000 2219
416620215 416702150
68241497 68295074
199770863 199825326
509726913 509815489
779096757 779176346
50301373 50395109
680442068 680513838
10672027 10753946
419155554 419225228
27993477 28074613
202777466 202848428
898431046 898501606
855439662 855516089
49972085 50058137
132037605 132105941
...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2219 lines

Test #87:

score: 0
Accepted
time: 3ms
memory: 4056kb

input:

3000 1971
273289960 273356035
645494918 645563363
294116810 294199291
654712464 654787915
325898403 325952171
900639603 900728124
214507936 214579081
891135731 891193900
184697938 184797874
513603004 513656867
547883255 547961511
5123630 5222722
402930073 402994785
781538375 781602407
110940514 1109...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
87
88
89
90
91
92
93
95
96
97
98
99
100
101
102
103
10...

result:

ok 1971 lines

Test #88:

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

input:

3000 2436
530935185 530988618
580187755 580240329
716942726 717012471
678190163 678283109
867364235 867425954
769776432 769859020
785270305 785322268
546531856 546591590
506863712 506938474
776239055 776326129
587366299 587464235
657153809 657240082
864540308 864638331
722990726 723046932
680337120 ...

output:

-1

result:

ok single line: '-1'

Test #89:

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

input:

3000 949
194920414 195903000
644679751 645454019
497467216 498253834
405122431 405961817
218320386 219078779
322523221 323031550
36276543 36798937
461861332 462815590
898761987 899501902
105276665 105978705
135929137 136486543
498864424 499613435
15581270 16269350
101987601 102536809
904757589 90571...

output:

2
4
5
6
7
8
10
11
12
13
14
15
16
17
18
20
21
22
23
24
26
27
29
30
31
33
34
35
36
37
40
41
42
43
44
45
46
49
50
51
53
54
55
56
58
59
60
61
62
64
65
68
69
70
71
72
73
76
78
79
80
81
83
85
87
88
89
91
95
96
97
98
102
103
104
105
106
107
110
111
116
117
118
120
121
124
126
127
128
129
130
131
132
133
13...

result:

ok 949 lines

Test #90:

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

input:

3000 852
8369209 8978440
26311257 27082715
933705072 934380857
827878226 828562378
366742358 367583321
68546569 69105189
971561637 972399204
765332686 766287459
773153255 774015481
61810651 62574804
918056514 918570559
140263391 141090102
52520069 53372496
884179770 884741439
956753275 957746050
226...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
31
32
33
35
36
37
38
39
40
42
43
45
46
47
48
49
50
51
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
70
71
72
73
74
75
76
77
79
80
81
82
83
85
86
87
88
89
90
91
92
94
95
96
97
98
99
101
103
105
107
108
109
110
112
113
114...

result:

ok 852 lines

Test #91:

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

input:

3000 739
497750401 498441996
267013399 267807392
918205023 919057677
326829272 327494027
753580445 754547251
35771377 36578633
808830658 809513795
56904078 57682462
887893164 888453875
329471353 330094906
100045968 100620573
896750067 897291941
283453808 284236716
324367485 325131611
770084423 77091...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42
43
44
45
46
47
48
49
50
51
53
54
55
57
58
59
60
61
62
63
64
65
67
68
69
70
72
73
74
75
76
77
78
79
80
82
83
84
85
86
87
88
89
90
91
92
93
96
97
98
101
102
103
104
106
107
108
109
110
111...

result:

ok 739 lines

Test #92:

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

input:

3000 925
420932447 421626010
904558008 905537878
655974505 656877253
514778277 515477813
199954685 200575289
293749166 294729902
179658408 180211242
326172243 326963713
527623498 528591366
65623235 66554247
399423541 400202725
520524243 521395427
283044209 284022490
179452315 180250519
505572370 506...

output:

-1

result:

ok single line: '-1'

Test #93:

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

input:

3000 153
587095114 596864273
670972487 676705997
191989357 198259167
673812587 683735533
245531196 254685257
225530225 234668988
452202357 458499572
272497340 280081758
87784636 93103291
670723843 678834868
50697649 60313556
951622145 958709103
382858098 389205982
676506551 681615487
384746612 39319...

output:

2
3
7
8
9
12
16
18
28
29
34
36
51
52
61
64
83
89
113
121
133
135
151
159
169
171
179
183
189
199
205
207
213
216
220
225
226
232
236
240
248
274
278
315
318
325
329
350
367
368
378
379
392
416
417
440
455
458
473
474
482
527
542
547
551
557
560
598
613
663
698
734
755
756
771
775
784
798
812
827
829...

result:

ok 153 lines

Test #94:

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

input:

3000 135
66885624 74104557
821414044 829087206
540699843 549726223
555899692 561078438
398755672 406020478
205882941 215435650
466732518 472842610
300990520 307907728
682356575 690744695
108052241 113305743
272402701 281220339
615723139 624160467
511470164 520171163
237176338 246766146
126512397 133...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19
21
22
23
24
25
26
27
28
36
37
38
42
44
47
48
52
53
55
64
70
79
81
87
91
99
104
108
119
120
129
139
141
153
161
178
188
200
206
208
229
232
242
255
270
276
298
315
335
347
364
417
429
432
450
467
480
483
496
518
539
553
556
577
578
589
619
634
640
661
672
...

result:

ok 135 lines

Test #95:

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

input:

3000 119
14458542 21844057
164839444 174229019
15409606 22270150
32376420 37743308
991477752 997728876
721021697 727700796
139296352 149247886
52968349 59742380
634812813 642348291
912839693 918945516
574242833 580891995
846393269 852631229
108377676 118035426
751791593 758482235
192318217 201297956...

output:

1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
19
20
21
22
23
24
25
26
29
30
31
32
35
36
38
39
40
41
42
43
45
46
47
48
49
50
56
59
61
63
64
69
70
71
72
73
76
82
84
86
87
89
90
95
101
102
104
106
110
112
118
123
128
131
149
151
155
164
168
174
175
177
186
205
222
242
260
291
296
298
300
317
325
360
376
436
481...

result:

ok 119 lines

Test #96:

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

input:

3000 151
476273765 485191811
728245332 737058902
289976217 298935950
663781569 673172371
748035322 753155742
63821194 69483396
193742953 201456928
308574266 314977699
883471433 890660435
32480997 41062430
913665000 920375502
582916096 590506484
502473679 507842105
770519594 779951926
868534486 87708...

output:

-1

result:

ok single line: '-1'

Test #97:

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

input:

3000 18
626228169 725462861
407984604 469727724
496462860 581426714
349402534 444725282
851576033 926964137
122559079 198333690
10516020 62745202
487022010 559792623
855212149 947900038
215521874 276667908
784521821 880702641
780738618 858450229
359331303 415600606
595034666 678823310
287408528 3419...

output:

7
15
24
198
246
497
765
1056
1065
1093
1761
2235
2280
2374
2612
2733
2772
2942

result:

ok 18 lines

Test #98:

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

input:

3000 17
51724110 123484345
576592988 636428271
600018459 658996800
238522792 311046511
78712172 169948003
481839811 554918345
883289292 974508498
817459393 869470842
8164804 93319273
13757914 110340582
539312692 621165605
583764195 669814808
603091776 670342368
215171402 269702052
900841098 97569590...

output:

2
8
9
93
205
242
348
540
1009
1535
1572
1663
1734
1854
1919
2360
2409

result:

ok 17 lines

Test #99:

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

input:

3000 14
338309257 391881083
731139079 830007360
869727747 929678461
390955786 444907914
267414436 319380458
868898573 955892832
483074302 571864191
366044466 419314941
83724165 159912013
412776485 488069098
427381885 484866879
257163375 350857004
257343424 311754437
157224579 221603757
582175530 638...

output:

1
2
3
5
9
10
18
41
97
461
839
1458
1750
1758

result:

ok 14 lines

Test #100:

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

input:

3000 19
814425216 892029587
337824132 411852724
731518837 829919458
123115390 194055950
627387987 685141124
310040043 373995220
408842867 496081307
905952989 998467966
728582451 803543185
369461294 461312810
125788557 201661655
59055678 111939661
381783704 470266639
870969920 942464280
7088303 78994...

output:

-1

result:

ok single line: '-1'

Test #101:

score: -31
Wrong Answer
time: 1ms
memory: 3728kb

input:

3000 3000
285375 361742
361742 1107858
1107858 1255748
1255748 3857978
3857978 4249535
4249535 4273015
4273015 4510876
4510876 4673623
4673623 5291542
5291542 5296509
5296509 5352452
5352452 5437629
5437629 6167983
6167983 6367767
6367767 6409548
6409548 6543578
6543578 6655685
6655685 6803906
68039...

output:

-1

result:

wrong answer 1st lines differ - expected: '1', found: '-1'

Subtask #4:

score: 0
Wrong Answer

Test #111:

score: 61
Accepted
time: 66ms
memory: 15988kb

input:

100000 361
136798318 785362988
255943758 535488232
175203444 266819907
766993466 893575347
67274251 589651108
662289594 883406317
830803801 849703610
729398668 798198453
202605534 677648797
66407931 925909114
174421361 601553812
522629146 701284080
136544340 295925673
299796891 499869765
736583725 8...

output:

42
102
185
215
660
950
1006
1623
1980
2396
2561
3016
3096
3729
3924
4119
4471
4619
4677
5229
5380
5400
5430
5681
5889
5901
5924
6013
6031
6043
6049
6316
6365
6483
6510
6575
7327
7492
7798
7833
7867
7954
7984
8089
8092
8237
8885
9212
9714
9971
10114
10190
10242
10260
10265
10321
10533
11184
11295
115...

result:

ok 361 lines

Test #112:

score: 0
Accepted
time: 65ms
memory: 15076kb

input:

100000 328
269692358 997698065
516351186 607170799
899165316 935984256
231654824 951113023
397634275 844276634
272944023 356674362
331036300 591789552
534270410 758375903
257707030 473980095
317825664 516882620
610579169 989404143
101902362 760414607
698174500 729348168
91656793 503436924
534091914 ...

output:

2
41
110
127
301
353
368
542
632
984
1394
1776
1932
2009
2051
2284
2584
2910
3083
3223
3445
3641
3715
4307
4467
4551
4602
4653
4900
5174
5601
5642
5748
5905
5910
6444
6547
7011
7070
7477
7713
7954
7965
8034
8066
8161
8235
8362
8527
8582
8807
8947
9051
9053
9329
9647
9689
9712
9807
9851
9916
10022
10...

result:

ok 328 lines

Test #113:

score: 0
Accepted
time: 65ms
memory: 15868kb

input:

100000 292
473961621 864888449
190522959 820646665
9492513 22301217
37064228 860062372
391795076 902791815
197180141 731578247
474804419 869235660
337420840 436563026
11453242 873644167
75360028 186126449
31699663 787244799
767030400 822993892
109557343 876905381
31823632 671368043
747618025 7999011...

output:

3
8
12
18
25
68
258
271
431
671
746
759
958
1130
1230
1847
2037
2193
2205
2448
2594
2746
3130
3188
3824
3896
4053
4208
4356
4551
4673
4790
4836
5178
5205
5231
5382
5565
5613
5814
5916
5980
6338
6440
6821
7045
7378
7553
7584
7615
7703
8766
8839
9191
9224
9749
9796
9800
9972
9988
10285
10296
10395
104...

result:

ok 292 lines

Test #114:

score: 0
Accepted
time: 64ms
memory: 15072kb

input:

100000 146
175643977 458162947
122110004 727270078
24786112 260954842
378646915 422692851
377845733 473430752
468331006 663764144
327593225 737427150
115723835 155636492
269251393 797888967
389252318 897957255
294924161 560923471
178959541 409597437
220814553 509182863
77416516 651426679
447529688 6...

output:

1
6
8
27
42
99
139
282
593
638
1498
1954
2189
2288
4171
4305
4554
4856
4868
5213
5937
6482
6599
7492
7533
7702
7724
7835
7990
8151
8501
9545
10202
11614
12938
13407
13837
14131
14484
15053
15176
15606
15895
16102
16185
16796
16976
17542
17882
18864
19357
19477
19478
20381
20680
20848
22319
24436
245...

result:

ok 146 lines

Test #115:

score: 0
Accepted
time: 63ms
memory: 16088kb

input:

100000 73
471315639 579688376
73440809 909550586
759672613 860952046
499195004 718627966
236201261 770008372
100210626 445253931
416166676 960255314
616242371 848806264
137142775 925433124
125434924 236893487
333557018 512133009
855283884 890613490
554762441 630311858
61488866 231607852
424705519 48...

output:

1
3
6
20
29
44
60
79
96
297
434
698
883
904
1549
4376
6599
7205
7681
8413
9369
11066
11578
14161
15267
17040
18750
20414
23432
24491
24836
26136
27044
28237
28824
29434
30047
32389
34359
36857
38954
39156
39268
41554
47253
48535
48950
49012
49889
51613
51764
52209
52747
54204
54511
56706
57029
57065...

result:

ok 73 lines

Test #116:

score: 0
Accepted
time: 72ms
memory: 15112kb

input:

100000 449
644158539 748655897
114191306 880648021
134735903 823826742
464626595 851003711
495548403 882519143
671995246 859736434
215469445 398614608
363408156 397305983
101857521 925632267
82075442 522481883
252114434 722683422
116631698 349587141
128286913 202260986
261266779 958361998
465162344 ...

output:

-1

result:

ok single line: '-1'

Test #117:

score: 0
Accepted
time: 76ms
memory: 16344kb

input:

100000 371
774872778 931145029
267285222 920663858
684750067 729615011
377126545 702601394
68070687 874096271
235493727 979169182
806547543 955959860
226247531 498179834
311248753 651142094
347633948 449123654
114029276 328842964
464871458 720251716
349016088 482553137
36050695 173717890
416596441 4...

output:

-1

result:

ok single line: '-1'

Test #118:

score: -61
Wrong Answer
time: 100ms
memory: 16404kb

input:

100000 93061
749089229 749090162
783721839 783722741
768123599 768124224
560078948 560079752
931037286 931037914
965510348 965510970
18421852 18422696
923870904 923871862
999039055 999039970
677283195 677283783
983315670 983316240
365325621 365326568
916687170 916687703
373584284 373585109
526888647...

output:

-1

result:

wrong answer 1st lines differ - expected: '1', found: '-1'