QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253699#7791. 通道建设 Passage Constructionhos_lyric#44.849113 26ms5604kbC++143.4kb2023-11-17 12:01:002024-07-04 02:26:01

Judging History

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

  • [2024-07-04 02:26:01]
  • 评测
  • 测评结果:44.849113
  • 用时:26ms
  • 内存:5604kb
  • [2023-11-17 12:01:00]
  • 提交

answer

#include "passageconstruction.h"

#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>

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")


mt19937_64 rng(59);

int N;
vector<vector<int>> graph;
vector<pair<int, int>> ans;

int dfs(int u) {
  int ret = -1;
  for (const int v : graph[u]) {
    const int res = dfs(v);
    if (~res) {
      if (~ret) {
        ans.emplace_back(ret, res);
        ret = -1;
      } else {
        ret = res;
      }
    }
  }
  if (~ret) {
    ans.emplace_back(ret, u);
    return -1;
  } else {
    return u;
  }
}

vector<pair<int, int>> ConstructPassages(int N_, const vector<pair<int, int>> &E) {
  N = N_;
  const int rt = 1 + rng() % (2 * N);
  vector<int> dep(2 * N + 1, -1), dep1(2 * N + 1, -1);
  int rt1 = rt;
  for (int u = 1; u <= 2 * N; ++u) {
    dep[u] = GetDistance(rt, u);
    if (dep[rt1] < dep[u]) {
      rt1 = u;
    }
  }
  for (int u = 1; u <= 2 * N; ++u) {
    dep1[u] = GetDistance(rt1, u);
  }
  vector<int> par(2 * N + 1, -1);
  if (getSubtaskID() == 4 || getSubtaskID() == 6) {
    for (const auto &e : E) {
      int u = e.first, v = e.second;
      if (dep[u] > dep[v]) {
        swap(u, v);
      }
      assert(dep[u] + 1 == dep[v]);
      par[v] = u;
    }
  }
  vector<int> path(dep[rt1] + 1, -1);
  for (int u = 1; u <= 2 * N; ++u) if (dep[rt1] == dep[u] + dep1[u]) {
    path[dep[u]] = u;
  }
  for (int d = 1; d <= dep[rt1]; ++d) {
    par[path[d]] = path[d - 1];
  }
  vector<vector<int>> layers(2 * N);
  for (int u = 1; u <= 2 * N; ++u) {
    layers[dep[u]].push_back(u);
  }
  for (int d = 1; d < 2 * N; ++d) {
    for (const int v : layers[d]) if (!~par[v]) {
      vector<int> us;
      for (int u = 1; u <= 2 * N; ++u) if (dep[u] + 1 == dep[v] && dep1[u] + 1 == dep1[v]) {
        us.push_back(u);
      }
      const int usLen = us.size();
      assert(usLen);
      shuffle(us.begin(), us.end(), rng);
      for (int j = 0; j < usLen; ++j) {
        const int u = us[j];
        if (j == usLen - 1 || QueryLCA({rt}, {u, v}, u)[0]) {
          par[v] = u;
          break;
        }
      }
    }
  }
  graph.assign(2 * N + 1, {});
  for (int u = 1; u <= 2 * N; ++u) if (~par[u]) {
    graph[par[u]].push_back(u);
  }
  dfs(rt);
  return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 3
Accepted

Test #1:

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

input:

1
1872884041
100 100 10000 10000
1
2294931821 2294931820

output:

Succeeded
0 4 0 0
1 2

result:

ok Accepted with 0+4 operations,sum of size(s)=0+0

Test #2:

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

input:

1
1977600624
100 100 10000 10000
5
621522394 621522399
2231003352 2231003338
464307841 464307837
1851407771 1851407768
2780336863 2780336849
314073909 314073902
1173467454 1173467430
4215033871 4215033843
2620057116 2620057098

output:

Succeeded
2 20 2 4
9 5
10 1
2 6
7 8
3 4

result:

ok Accepted with 2+20 operations,sum of size(s)=2+4

Test #3:

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

input:

1
1314992723
100 100 10000 10000
2
1174248192 1174248188
4206147071 4206147069
2894997654 2894997645

output:

Succeeded
0 8 0 0
1 3
2 4

result:

ok Accepted with 0+8 operations,sum of size(s)=0+0

Test #4:

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

input:

1
1466488642
100 100 10000 10000
3
1959342134 1959342129
3976386946 3976386946
1293201451 1293201449
4016912388 4016912383
46728190 46728181

output:

Succeeded
0 12 0 0
1 4
5 6
3 2

result:

ok Accepted with 0+12 operations,sum of size(s)=0+0

Test #5:

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

input:

1
1733551538
100 100 10000 10000
4
4255320958 4255320951
1233889267 1233889267
2022156010 2022156014
1746602236 1746602223
1796304111 1796304099
154520793 154520786
799267407 799267389

output:

Succeeded
0 16 0 0
7 3
5 2
1 6
4 8

result:

ok Accepted with 0+16 operations,sum of size(s)=0+0

Test #6:

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

input:

1
1103590331
100 100 10000 10000
4
3735090189 3735090176
179620503 179620501
1550955883 1550955882
3533004575 3533004552
2159969243 2159969227
2549716219 2549716202
1755562372 1755562356

output:

Succeeded
0 16 0 0
3 1
6 5
4 2
7 8

result:

ok Accepted with 0+16 operations,sum of size(s)=0+0

Test #7:

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

input:

1
1007922703
100 100 10000 10000
5
3347355425 3347355424
924935451 924935434
3554593528 3554593525
2830078883 2830078872
3185621515 3185621508
32902500 32902483
1057526055 1057526035
3737430162 3737430144
106424402 106424399

output:

Succeeded
0 20 0 0
2 3
8 5
9 6
7 10
1 4

result:

ok Accepted with 0+20 operations,sum of size(s)=0+0

Test #8:

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

input:

1
1401446296
100 100 10000 10000
5
4125806477 4125806476
1224445301 1224445291
1474144594 1474144597
2898586557 2898586536
879608888 879608877
3110900945 3110900930
2490037068 2490037051
422424582 422424570
1017432306 1017432295

output:

Succeeded
5 20 5 10
2 6
1 3
7 10
5 8
9 4

result:

ok Accepted with 5+20 operations,sum of size(s)=5+10

Test #9:

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

input:

1
1756894897
100 100 10000 10000
5
2081532117 2081532115
4275738287 4275738273
632146529 632146534
2424607270 2424607263
2157363450 2157363443
2463928559 2463928550
3381117807 3381117785
4186361975 4186361960
3382018566 3382018532

output:

Succeeded
0 20 0 0
7 9
8 5
10 6
3 2
1 4

result:

ok Accepted with 0+20 operations,sum of size(s)=0+0

Test #10:

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

input:

1
1465320926
100 100 10000 10000
5
2695813796 2695813789
3049323317 3049323309
231883125 231883119
3073242409 3073242392
1388430756 1388430755
183732731 183732729
1423324287 1423324267
3470698806 3470698795
354321542 354321525

output:

Succeeded
1 20 1 2
6 2
1 8
9 3
7 10
5 4

result:

ok Accepted with 1+20 operations,sum of size(s)=1+2

Subtask #2:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 1ms
memory: 4216kb

input:

2
755640766
20000 10000 200000 200000
100
4287951944 4287951892
218593589 218593610
2907028702 2907028595
100123056 100122959
3149201405 3149201229
3454414687 3454414608
1901257489 1901257490
1532337798 1532337686
836222214 836222227
187381584 187381446
1847826999 1847827071
2868544732 2868544653
41...

output:

Succeeded
1176 400 1176 2352
71 13
76 20
57 163
170 18
16 2
127 174
9 60
28 45
88 58
133 17
29 82
27 59
64 122
41 47
37 54
62 131
93 90
44 114
85 134
124 150
158 166
116 22
14 119
142 87
69 46
56 99
15 42
193 8
195 19
61 78
164 95
32 77
98 182
50 49
180 91
181 115
25 189
5 194
51 84
172 143
185 160
...

result:

ok Accepted with 1176+400 operations,sum of size(s)=1176+2352

Test #12:

score: 6
Accepted
time: 1ms
memory: 3984kb

input:

2
587237803
20000 10000 200000 200000
98
217447661 217447616
2463641363 2463641406
3373538248 3373538212
3950835015 3950834997
2221322822 2221322872
146298284 146298141
531452967 531453049
3941453926 3941454046
3084946195 3084946149
1270490559 1270490368
1019372524 1019372347
2754251578 2754251434
5...

output:

Succeeded
770 392 770 1540
59 100
76 109
10 56
57 48
71 47
22 51
131 127
93 182
161 104
85 19
18 62
30 73
40 187
81 121
2 98
111 169
145 176
82 122
13 136
113 91
72 130
96 101
148 49
65 159
120 151
90 192
112 108
44 64
29 117
31 116
80 147
26 194
163 32
4 171
1 12
14 61
17 33
191 78
55 128
28 150
14...

result:

ok Accepted with 770+392 operations,sum of size(s)=770+1540

Test #13:

score: 6
Accepted
time: 1ms
memory: 3988kb

input:

2
184226984
20000 10000 200000 200000
99
547000384 547000355
872110096 872110116
1289538184 1289538247
3616724666 3616724569
636341527 636341600
2563522202 2563522274
2177548205 2177548137
3089489449 3089489506
3156380759 3156380856
944465184 944465231
823584265 823584499
333051247 333051023
1754238...

output:

Succeeded
627 396 627 1254
73 121
74 17
180 48
35 49
195 116
148 161
51 168
16 92
26 98
56 136
190 21
43 94
6 54
153 152
112 107
111 162
101 125
193 196
123 173
104 149
81 71
103 144
170 169
65 91
176 177
75 108
110 52
102 174
194 70
120 124
166 160
155 159
105 109
106 142
146 189
158 57
178 150
46 ...

result:

ok Accepted with 627+396 operations,sum of size(s)=627+1254

Test #14:

score: 6
Accepted
time: 1ms
memory: 3916kb

input:

2
1727138930
20000 10000 200000 200000
99
3247483138 3247483162
4084597375 4084597429
2636905019 2636904971
946660642 946660700
902149328 902149350
2382255766 2382255865
839303047 839303137
1923325547 1923325538
653690681 653690724
4175318562 4175318731
3824454449 3824454478
2650316775 2650316587
58...

output:

Succeeded
769 396 769 1538
101 102
161 120
111 182
133 134
117 112
105 118
132 140
109 119
125 145
178 30
194 22
92 108
153 77
6 36
17 177
27 196
59 72
32 80
184 5
137 139
51 149
126 162
3 195
73 78
35 15
26 113
129 160
39 60
53 57
151 189
146 82
148 180
47 21
29 71
8 90
198 88
79 116
34 98
114 172
...

result:

ok Accepted with 769+396 operations,sum of size(s)=769+1538

Test #15:

score: 6
Accepted
time: 1ms
memory: 3936kb

input:

2
1220143324
20000 10000 200000 200000
100
693596313 693596332
62576744 62576808
1955936424 1955936264
3872655610 3872655531
1013531683 1013531829
2985331208 2985331369
2406362516 2406362582
1657349556 1657349602
1003910904 1003910721
1096398841 1096398795
1778724026 1778723842
713692268 713692342
2...

output:

Succeeded
692 400 692 1384
189 91
185 137
22 155
126 158
183 187
115 146
125 166
103 198
105 143
191 18
57 117
35 12
55 156
27 46
148 167
16 45
70 88
30 97
179 31
92 107
177 77
145 82
169 180
85 95
71 110
36 134
197 176
41 64
5 3
109 178
28 60
165 89
33 48
139 62
25 135
74 196
65 84
131 67
98 43
195...

result:

ok Accepted with 692+400 operations,sum of size(s)=692+1384

Test #16:

score: 6
Accepted
time: 1ms
memory: 3880kb

input:

2
442130601
20000 10000 200000 200000
100
3144169521 3144169542
3602466736 3602466791
26223369 26223537
866636824 866636802
1192888944 1192888905
2768179340 2768179316
992350648 992350588
1606144049 1606144118
2825460299 2825460268
2783910130 2783910118
403964521 403964517
445570315 445570360
126026...

output:

Succeeded
684 400 684 1368
70 44
51 61
119 169
14 75
147 52
132 149
156 17
45 82
200 11
36 131
140 91
117 130
183 115
41 100
18 54
133 194
56 158
168 26
198 107
199 159
145 127
114 167
150 182
195 10
179 110
174 120
124 184
42 88
58 68
137 95
74 22
3 29
196 87
27 104
39 62
176 57
19 31
192 154
64 49...

result:

ok Accepted with 684+400 operations,sum of size(s)=684+1368

Test #17:

score: 6
Accepted
time: 1ms
memory: 3984kb

input:

2
949343282
20000 10000 200000 200000
97
1170242583 1170242801
4247921283 4247921322
1529679099 1529679065
1051858814 1051858774
3893889966 3893889994
3958531511 3958531352
2502650796 2502650862
813064156 813064047
1048780624 1048780414
3993902928 3993902731
803344004 803343802
3547336751 3547336794...

output:

Succeeded
1005 388 1005 2010
122 31
10 176
30 39
98 54
40 135
72 43
182 28
63 75
29 117
97 115
183 142
85 179
16 144
101 73
148 76
112 138
79 189
77 87
17 127
21 18
99 32
94 145
109 36
9 96
132 136
141 46
100 155
118 165
160 193
174 45
88 164
102 163
111 172
187 4
5 66
95 166
2 110
70 133
56 81
6 50...

result:

ok Accepted with 1005+388 operations,sum of size(s)=1005+2010

Test #18:

score: 6
Accepted
time: 1ms
memory: 3936kb

input:

2
734508634
20000 10000 200000 200000
98
213911368 213911499
2488548419 2488548499
516780967 516780705
3349442602 3349442765
857297035 857297029
1348690665 1348690579
1548954171 1548954133
3605026599 3605026727
182470368 182470292
1455323224 1455323364
2179991017 2179991001
3209649930 3209649949
145...

output:

Succeeded
1004 392 1004 2008
25 28
121 84
1 24
130 44
49 15
126 42
34 107
32 43
69 105
59 188
122 189
74 68
37 114
98 73
96 82
195 124
52 85
86 163
120 40
143 153
90 179
35 180
13 140
54 151
18 22
87 176
78 55
159 4
2 31
23 83
112 64
5 33
158 144
9 77
16 93
184 152
194 12
63 171
172 26
101 186
92 95...

result:

ok Accepted with 1004+392 operations,sum of size(s)=1004+2008

Subtask #3:

score: 8
Accepted

Test #19:

score: 8
Accepted
time: 3ms
memory: 4788kb

input:

3
397960972
100000 4000 200000 200000
1000
3136131587 3136131078
3887641427 3887642253
280951546 280951198
124187343 124186744
3948118891 3948118785
2174920490 2174920140
3041102338 3041103477
489656932 489656480
3093689453 3093690199
3027233105 3027233261
967551350 967551424
215138938 215138436
251...

output:

Succeeded
0 4000 0 0
1855 1366
1563 1773
1275 1969
1313 1368
1409 1107
1727 1643
1837 1134
1600 1844
1114 1677
1937 1610
1588 1122
1298 1630
1755 1829
1178 1561
1357 1852
1394 1347
1054 1751
1887 1806
1266 1164
1579 1868
1609 1824
1276 1613
1078 1697
1866 1272
1554 1009
1223 1477
1214 1462
1465 1259...

result:

ok Accepted with 0+4000 operations,sum of size(s)=0+0

Test #20:

score: 8
Accepted
time: 3ms
memory: 4524kb

input:

3
755523510
100000 4000 200000 200000
999
837610461 837610217
209552123 209552158
2202987134 2202987346
3933843218 3933843131
2783546817 2783547323
415275024 415276142
13876082 13876176
448702939 448703028
1294393612 1294394136
3910397405 3910397094
3416630484 3416630700
3215888394 3215888948
124509...

output:

Succeeded
0 3996 0 0
728 346
13 1690
49 468
103 745
485 897
149 86
913 82
826 735
750 408
41 83
365 202
414 124
1200 301
843 283
77 694
266 156
840 789
1764 767
938 878
618 959
1564 90
20 249
51 275
994 396
1144 585
429 732
85 692
665 234
380 739
969 1630
626 449
132 884
583 558
660 1634
505 344
172...

result:

ok Accepted with 0+3996 operations,sum of size(s)=0+0

Test #21:

score: 8
Accepted
time: 2ms
memory: 4924kb

input:

3
2042812129
100000 4000 200000 200000
998
3075748308 3075748844
1569673104 1569672823
3968525693 3968524672
2108387096 2108386924
3356390455 3356391094
3372812724 3372813320
3904961007 3904958854
4029621824 4029621345
4114486509 4114486281
1387138301 1387138067
124292409 124292880
3935517019 393551...

output:

Succeeded
0 3992 0 0
1325 1749
1702 1332
1114 1225
1984 1397
1723 1307
1737 1658
1495 1813
1051 1838
1316 1067
1922 1696
1402 1946
1355 1363
1886 1208
1247 1539
1072 1505
1947 1484
1581 1267
1561 1375
1992 1379
1868 1655
1545 1678
1945 1279
1478 1065
1965 1553
1953 1368
1682 1835
1823 1176
1376 1063...

result:

ok Accepted with 0+3992 operations,sum of size(s)=0+0

Test #22:

score: 8
Accepted
time: 2ms
memory: 4864kb

input:

3
1597029305
100000 4000 200000 200000
998
2980500284 2980500361
2247716226 2247714887
988714926 988714253
1734063960 1734064121
2359409219 2359409008
411968449 411968499
155449826 155451318
555582797 555582911
45071917 45071590
1460631113 1460629818
3059213925 3059213709
2094519932 2094519250
38721...

output:

Succeeded
0 3992 0 0
1767 345
262 528
580 38
1719 910
1612 226
1391 1016
1557 719
431 130
1537 941
1894 322
1572 1024
1713 1082
1539 697
846 1712
1100 1898
293 1595
1970 1512
119 685
748 1521
282 245
551 419
1301 1688
857 774
488 1177
1854 1558
1950 1579
1136 576
1600 219
760 1643
167 887
1717 1762
...

result:

ok Accepted with 0+3992 operations,sum of size(s)=0+0

Test #23:

score: 8
Accepted
time: 2ms
memory: 4580kb

input:

3
1564467111
100000 4000 200000 200000
1000
1236547222 1236547523
2135786902 2135787064
2523622442 2523622714
1532839693 1532838477
818219113 818220033
676117995 676118414
570037547 570036834
514220702 514220842
3399494183 3399495268
2654728241 2654729498
1495037081 1495037412
2062047312 2062048382
...

output:

Succeeded
0 4000 0 0
257 1077
429 825
365 1158
1910 1574
178 1855
1371 1318
1452 960
141 558
1666 607
37 1482
281 1130
1775 1710
1008 1257
415 1773
1409 1804
1557 519
57 1335
1163 839
389 444
431 1554
1981 757
326 1585
36 1885
1882 19
1093 1307
180 866
1774 1324
1572 1355
1058 1280
413 1397
481 526
...

result:

ok Accepted with 0+4000 operations,sum of size(s)=0+0

Test #24:

score: 8
Accepted
time: 3ms
memory: 4588kb

input:

3
213138336
100000 4000 200000 200000
999
1130123143 1130122958
687694550 687694095
929485247 929484829
3680984473 3680983776
3074105335 3074104892
1342732123 1342731927
1364720805 1364720672
2077428724 2077428538
28510235 28511166
937776441 937776505
3414480885 3414480666
3148182306 3148181509
3485...

output:

Succeeded
0 3996 0 0
837 581
427 276
84 423
90 646
277 760
687 28
530 444
5 895
21 141
497 458
564 381
237 27
271 465
293 231
808 524
79 104
301 755
596 482
390 998
147 498
351 951
283 580
754 246
60 884
647 412
402 398
817 1356
258 1915
363 645
138 662
967 953
379 324
543 567
492 494
961 556
788 21...

result:

ok Accepted with 0+3996 operations,sum of size(s)=0+0

Test #25:

score: 8
Accepted
time: 3ms
memory: 4536kb

input:

3
924980045
100000 4000 200000 200000
998
1666991999 1666991279
148686690 148685590
324531768 324531788
2043725358 2043725640
1133184972 1133184631
853139746 853139683
1770837584 1770837761
1481554510 1481554714
1372084869 1372084950
1756084441 1756085236
2107756067 2107756010
3377586774 3377586312
...

output:

Succeeded
0 3992 0 0
702 874
78 412
551 608
661 662
1099 473
745 406
1850 447
28 481
746 714
411 511
738 317
1 1564
444 62
4 757
363 134
135 800
980 204
1971 184
98 611
175 967
998 775
1536 48
598 208
846 42
744 290
388 556
414 1003
762 271
99 460
139 850
512 6
509 68
839 159
790 1864
77 164
239 618...

result:

ok Accepted with 0+3992 operations,sum of size(s)=0+0

Test #26:

score: 8
Accepted
time: 2ms
memory: 4692kb

input:

3
774146483
100000 4000 200000 200000
999
3478842381 3478843345
606332045 606332562
2701123033 2701123563
3216754910 3216755036
1217043418 1217043429
1501603802 1501603474
1778234551 1778234769
1444790432 1444791022
2502984240 2502984288
856947428 856947122
1363006586 1363006323
1995567044 199556642...

output:

Succeeded
0 3996 0 0
233 436
55 112
711 125
874 394
419 462
171 1792
184 552
271 927
608 160
470 764
397 611
165 705
819 172
978 174
153 633
937 57
128 482
971 508
940 894
1740 34
835 314
720 261
868 801
322 751
816 628
1659 717
325 961
590 51
203 760
623 339
1905 9
120 447
181 375
880 575
869 209
3...

result:

ok Accepted with 0+3996 operations,sum of size(s)=0+0

Test #27:

score: 8
Accepted
time: 3ms
memory: 4488kb

input:

3
82266506
100000 4000 200000 200000
999
3056998601 3056998876
1887811910 1887812134
1616045105 1616045172
1784967209 1784967615
650919784 650918837
4290024152 4290024396
154133667 154133653
754913686 754913998
3014551042 3014550770
3332698384 3332698431
304657473 304657856
1466514044 1466515029
313...

output:

Succeeded
0 3996 0 0
96 486
1192 715
312 589
107 967
316 566
1406 1741
758 276
1743 283
449 762
466 189
72 30
428 376
596 26
868 235
430 208
152 638
612 341
1629 1289
1249 893
698 198
77 574
919 981
147 711
739 491
1910 773
229 1475
1960 584
274 1345
658 369
382 587
313 945
937 957
130 468
645 679
8...

result:

ok Accepted with 0+3996 operations,sum of size(s)=0+0

Test #28:

score: 8
Accepted
time: 3ms
memory: 4636kb

input:

3
1746021239
100000 4000 200000 200000
1000
3649747382 3649747015
3895797253 3895797184
4001365723 4001365122
564220364 564220085
362710516 362710456
2800243662 2800243024
2073687310 2073687797
145701776 145700951
492159209 492159366
3076148714 3076148148
1548738755 1548739322
3580263095 3580262700
...

output:

Succeeded
0 4000 0 0
1505 461
278 68
172 488
203 562
808 724
766 209
527 423
907 998
336 1849
408 410
1639 333
396 588
704 389
96 837
505 156
206 963
212 149
124 355
745 524
232 427
996 640
251 552
912 262
197 249
44 595
469 141
296 91
358 681
274 850
526 1096
1266 1649
1137 1015
1653 1029
1838 1755...

result:

ok Accepted with 0+4000 operations,sum of size(s)=0+0

Subtask #4:

score: 9
Accepted

Test #29:

score: 9
Accepted
time: 2ms
memory: 4360kb

input:

4
1084797752
100000 4000 200000 200000
1000
3456536122 3456534568
249115651 249115791
3576312078 3576312237
1880897416 1880895547
1944688480 1944688327
248846397 248847256
3567405828 3567405196
1084965392 1084965206
1435956247 1435955729
3887033767 3887032464
307260230 307260472
1476733874 147673312...

output:

Succeeded
12135 4000 12135 24270
1458 1981
1739 1538
1130 1819
1011 896
508 230
1339 653
539 647
478 815
893 581
1900 1741
1465 1791
1659 1726
1827 1467
1459 1472
1123 1841
256 592
1307 47
111 679
157 583
1212 1754
394 208
1001 1984
1075 34
371 836
762 942
1453 541
1818 1003
1597 245
522 956
1539 17...

result:

ok Accepted with 12135+4000 operations,sum of size(s)=12135+24270

Test #30:

score: 9
Accepted
time: 3ms
memory: 4624kb

input:

4
583125216
100000 4000 200000 200000
1000
1729488108 1729488695
2234303914 2234304325
546617298 546616102
842050918 842051470
1951502077 1951501331
4271815110 4271815116
761587681 761586756
2172224244 2172223957
2934428060 2934428507
1919912734 1919912263
1067575137 1067574604
3411448089 3411447166...

output:

Succeeded
308 4000 308 616
1402 1104
1563 1420
1869 1105
1934 1431
1552 1815
1577 1510
1746 1971
1773 1568
1732 1247
1500 1713
1958 1321
1101 1591
1357 1906
1835 1730
1842 1636
494 330
860 969
995 861
600 350
133 174
112 733
262 513
284 274
219 207
542 137
433 238
548 328
281 193
106 967
533 712
107...

result:

ok Accepted with 308+4000 operations,sum of size(s)=308+616

Test #31:

score: 9
Accepted
time: 4ms
memory: 4516kb

input:

4
1854731567
100000 4000 200000 200000
998
946750857 946749479
898868556 898868101
2271278746 2271277916
1796596168 1796596321
161487283 161486866
1033814116 1033814195
2395521961 2395522326
1468519383 1468519080
2816096970 2816096367
1556209002 1556208501
3292442187 3292440851
1135140030 1135140110...

output:

Succeeded
11854 3992 11854 23708
1833 1541
1794 1995
75 1316
151 1271
1390 1667
1732 1328
17 887
1676 997
657 89
1303 414
1661 449
1784 1505
609 748
971 977
1076 1953
1477 1937
6 679
1304 1548
1573 468
460 82
1658 1256
1599 51
1019 1879
961 1276
1131 1261
667 1631
928 1437
484 612
1609 1785
1367 174...

result:

ok Accepted with 11854+3992 operations,sum of size(s)=11854+23708

Test #32:

score: 9
Accepted
time: 3ms
memory: 4480kb

input:

4
2073988041
100000 4000 200000 200000
998
3168161931 3168162584
641363905 641362895
3784715137 3784714618
3548409026 3548409673
2737710699 2737710016
3324804481 3324803425
60841104 60840338
2010919705 2010919496
2362840315 2362840326
369236350 369237998
3600238093 3600237006
75182169 75182747
23418...

output:

Succeeded
39564 3992 39564 79128
1407 1628
1835 28
1151 1367
1815 377
1384 1494
434 400
1855 1454
1730 551
1164 1629
1039 976
1843 1687
1934 1908
918 481
755 435
1443 632
1760 1761
886 243
1799 525
1051 1015
134 163
1157 1196
1710 794
1480 1086
1808 959
1330 315
1235 1731
1774 944
119 453
1373 593
1...

result:

ok Accepted with 39564+3992 operations,sum of size(s)=39564+79128

Test #33:

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

input:

4
1770340944
100000 4000 200000 200000
998
619870796 619870703
3121053787 3121054050
4195183636 4195182734
3139119614 3139119172
3634777517 3634777854
3433281440 3433281395
1485638549 1485638667
1231357421 1231357552
1705009906 1705010057
3514693637 3514694012
4265358236 4265358262
964902776 9649023...

output:

Succeeded
14613 3992 14613 29226
527 1907
1715 1017
1566 1144
1953 1205
261 390
1544 1414
1584 444
1156 1664
1628 446
423 855
1117 1085
1291 1758
78 1901
328 686
207 712
718 35
1006 1234
544 1556
1151 565
557 716
794 1276
1548 52
1554 1654
1158 1652
1243 543
1982 1963
1444 1634
1798 1588
1857 1985
6...

result:

ok Accepted with 14613+3992 operations,sum of size(s)=14613+29226

Test #34:

score: 9
Accepted
time: 7ms
memory: 4344kb

input:

4
402901589
100000 4000 200000 200000
1000
1228378193 1228378597
1873458243 1873458214
2590411172 2590411391
3596693908 3596693672
442343415 442341879
1371534355 1371535333
1713867379 1713867258
2725534246 2725534433
3960722519 3960721503
1846001052 1846001387
2925453274 2925452776
1709191822 170919...

output:

Succeeded
40391 4000 40391 80782
1817 1904
306 774
1024 1323
1698 298
502 317
1625 1774
4 744
1870 1134
1927 1341
1333 1129
406 556
264 328
1667 1718
1028 437
1614 1242
1599 666
1711 353
1005 1911
496 589
124 240
226 867
1099 1894
9 663
1845 357
1982 549
19 379
457 950
1336 1645
110 448
409 655
149 ...

result:

ok Accepted with 40391+4000 operations,sum of size(s)=40391+80782

Test #35:

score: 9
Accepted
time: 7ms
memory: 4428kb

input:

4
816997292
100000 4000 200000 200000
1000
3528745308 3528745448
2554369604 2554370028
2428697713 2428697760
2283123422 2283123636
2317970372 2317971439
3486243575 3486243354
914803066 914803223
3870938133 3870937913
833775363 833775109
133819724 133819108
4164722879 4164723079
4283955483 4283956051...

output:

Succeeded
36763 4000 36763 73526
1575 1983
1058 1767
1344 223
34 337
1721 1540
1759 1994
1564 1390
1170 1592
308 957
462 407
1780 1846
1419 1615
1391 1142
1086 617
55 38
365 606
444 984
1843 409
1137 648
1139 625
956 979
677 375
1054 1655
1681 1359
5 202
1604 976
307 978
17 869
26 670
1634 1653
1677...

result:

ok Accepted with 36763+4000 operations,sum of size(s)=36763+73526

Test #36:

score: 9
Accepted
time: 9ms
memory: 4328kb

input:

4
448483706
100000 4000 200000 200000
1000
3294405857 3294406138
1334269388 1334268750
3218236158 3218236229
1172020015 1172020961
4267095542 4267095785
884218942 884218794
2727697704 2727696787
4040088499 4040088016
3925649252 3925648708
3602778930 3602778977
25062275 25062940
782102904 782103485
4...

output:

Succeeded
61402 4000 61402 122804
1051 1158
1296 1855
1876 1249
1399 1543
1410 1284
685 852
1347 1524
1540 1619
1104 1254
697 943
638 689
1814 1652
1914 521
1966 1171
1238 1653
1469 1771
1179 995
1568 1332
1849 1802
1431 1464
1191 1722
1831 50
1111 477
455 642
528 825
1749 1755
1686 1787
1207 1394
1...

result:

ok Accepted with 61402+4000 operations,sum of size(s)=61402+122804

Test #37:

score: 9
Accepted
time: 3ms
memory: 4512kb

input:

4
1345753551
100000 4000 200000 200000
1000
2505101245 2505099844
1064732384 1064732096
3514288208 3514289196
4285598713 4285598588
289512304 289512216
961277738 961276571
270988037 270987782
351038556 351038779
2313748299 2313748400
3024327557 3024327268
1007549868 1007549449
3171882049 3171882337
...

output:

Succeeded
101 4000 101 202
1079 146
861 148
1734 357
1465 438
1236 1720
1375 1357
609 950
1806 1880
250 1210
1749 1144
759 1514
198 1699
351 1417
1431 1291
665 445
1820 1434
1837 1222
531 1519
794 939
1044 1597
59 1414
508 314
1910 1800
1617 404
26 365
1277 769
539 920
1703 1234
1180 963
58 627
172 ...

result:

ok Accepted with 101+4000 operations,sum of size(s)=101+202

Test #38:

score: 9
Accepted
time: 3ms
memory: 4724kb

input:

4
163480472
100000 4000 200000 200000
998
2002085756 2002085748
2640607139 2640605823
836452341 836452238
179712028 179712352
1546416317 1546416341
3648734029 3648733547
4142213872 4142214412
711606286 711606592
1732581221 1732580465
2405962256 2405961750
1644716795 1644717277
589785362 589783494
12...

output:

Succeeded
269 3992 269 538
1996 502
1795 1398
1481 29
1136 1661
1474 1563
1571 1586
1760 582
1113 1153
855 661
1193 561
999 624
1098 299
464 254
1049 1625
1736 1898
792 771
346 285
1047 1888
444 207
382 291
424 568
215 1291
1572 1085
492 721
1521 691
816 925
91 891
1017 784
1139 1836
1208 357
6 697
...

result:

ok Accepted with 269+3992 operations,sum of size(s)=269+538

Subtask #5:

score: 11
Accepted

Test #39:

score: 11
Accepted
time: 8ms
memory: 4428kb

input:

5
1720909858
50000 4000 200000 100000
998
195378529 195378218
2138942224 2138942028
2421726252 2421725316
2614111628 2614111784
3778296551 3778295886
3346314089 3346313971
701234060 701233448
279201944 279202119
69826850 69826766
2173156660 2173157126
2982274003 2982273048
2306106121 2306107345
2808...

output:

Succeeded
38404 3992 38404 76808
1630 697
819 229
366 865
363 418
528 655
293 852
875 1010
1669 340
892 1445
958 1391
14 354
534 668
1546 1578
327 646
225 963
1057 1439
1220 1049
432 847
955 1698
531 303
183 279
385 410
1106 1038
736 1150
1215 1658
657 417
1848 1858
1133 1476
1194 997
1601 1127
1077...

result:

ok Accepted with 38404+3992 operations,sum of size(s)=38404+76808

Test #40:

score: 11
Accepted
time: 6ms
memory: 4392kb

input:

5
1942257410
50000 4000 200000 100000
999
164109252 164108690
821766476 821766590
800182177 800180581
3645999838 3646000976
4086503876 4086505410
2171679381 2171678745
2952329225 2952330453
1354218636 1354219071
1174819694 1174820521
2253012620 2253012650
1329779110 1329779087
2814346065 2814346500
...

output:

Succeeded
11424 3996 11424 22848
1227 1524
389 892
861 671
1119 1573
1084 307
1716 1586
732 1975
1505 294
1580 1285
1981 734
532 230
1850 233
1483 1867
494 444
1702 26
264 455
772 1809
628 1170
1071 1129
1523 209
1165 1251
1522 443
810 1172
625 1008
964 1499
845 283
321 1437
87 601
437 1454
1140 917...

result:

ok Accepted with 11424+3996 operations,sum of size(s)=11424+22848

Test #41:

score: 11
Accepted
time: 4ms
memory: 4440kb

input:

5
161065852
50000 4000 200000 100000
1000
2966551129 2966552287
2856618787 2856618848
3795294524 3795295808
2757765097 2757764165
676105640 676105847
570204851 570205160
511088706 511090077
3497329264 3497329269
3725322378 3725322886
527017111 527016211
4071607765 4071607337
2817593784 2817593642
15...

output:

Succeeded
820 4000 820 1640
1387 1898
1362 432
98 1697
1779 1719
1073 203
1646 1274
666 1359
1914 1959
1328 1351
1812 220
1695 1307
1875 410
1058 1198
664 660
544 265
1358 768
1809 1651
1574 1587
39 105
1290 814
1747 108
1834 1320
1319 833
492 1244
313 1980
323 510
769 613
289 629
1879 527
826 577
1...

result:

ok Accepted with 820+4000 operations,sum of size(s)=820+1640

Test #42:

score: 11
Accepted
time: 3ms
memory: 4300kb

input:

5
777230405
50000 4000 200000 100000
999
3830467265 3830466694
1849159126 1849158949
2825053043 2825052212
2761591040 2761591070
939276197 939275664
3367167096 3367167288
3727731406 3727730932
406701926 406701618
530187802 530186715
3962995171 3962996546
1787609584 1787609620
993000803 993000542
158...

output:

Succeeded
28040 3996 28040 56080
590 705
218 382
844 1079
763 1099
78 1604
968 996
492 1899
1067 821
1640 1117
1493 1383
1342 1596
1761 1966
1464 1988
1700 1797
1817 1201
1780 891
1772 1198
1692 1534
1764 1910
1642 1243
1180 1424
666 84
50 438
1894 778
561 1717
952 1323
339 1735
463 1498
759 910
115...

result:

ok Accepted with 28040+3996 operations,sum of size(s)=28040+56080

Test #43:

score: 11
Accepted
time: 7ms
memory: 4408kb

input:

5
97972513
50000 4000 200000 100000
999
654921388 654921281
3336987454 3336987177
439399097 439398662
1551555981 1551555288
3555879532 3555880729
2903638861 2903639277
257794283 257794433
3826111358 3826111966
1708274143 1708274017
3746235685 3746236123
907908447 907908765
4116365217 4116364822
1582...

output:

Succeeded
28051 3996 28051 56102
1562 1821
1105 1697
1738 1766
1154 1632
1156 1972
1177 1712
1689 1975
1368 1392
1716 1857
1463 1699
1419 1014
1571 1625
1119 1768
1714 1366
1067 1649
1935 1199
1355 1602
1263 1266
1284 1618
1844 1013
1786 1950
1553 1752
1316 1978
1209 1399
1865 1892
1573 295
599 1286...

result:

ok Accepted with 28051+3996 operations,sum of size(s)=28051+56102

Test #44:

score: 11
Accepted
time: 7ms
memory: 4436kb

input:

5
397162223
50000 4000 200000 100000
1000
2103775764 2103775539
3507938589 3507938863
4080657108 4080657210
2492592687 2492593001
111756474 111755329
3545417212 3545415789
3115563885 3115563458
2404092040 2404092248
1717324095 1717323827
2910355772 2910355898
40550063 40549395
1332934233 1332933830
...

output:

Succeeded
25505 4000 25505 51010
503 214
6 137
1599 897
343 1199
200 53
74 884
81 610
1492 334
1051 1549
36 1944
789 827
1574 400
413 1019
838 1712
210 1867
543 621
1646 702
633 1089
920 1943
748 927
892 459
1447 382
1352 472
1325 864
508 59
1028 1832
1761 1688
1211 3
1762 1010
231 248
833 1054
1543...

result:

ok Accepted with 25505+4000 operations,sum of size(s)=25505+51010

Test #45:

score: 11
Accepted
time: 3ms
memory: 4836kb

input:

5
1695502059
50000 4000 200000 100000
1000
700852541 700853138
286392703 286393228
862046288 862047179
1594299681 1594299408
3210366802 3210366961
1413959809 1413960445
3698437765 3698437869
1377184122 1377184197
281217513 281217619
145372596 145373148
502398350 502398463
2741843047 2741843594
34564...

output:

Succeeded
0 4000 0 0
1551 1171
1879 1323
1027 1452
1185 1414
1513 1943
1794 1775
1356 1799
1703 1803
1476 1228
1041 1327
1853 1674
1366 1595
1809 1326
1539 1899
1549 1436
1813 1328
1723 1147
1747 1206
1804 1043
1375 1756
1462 1096
1573 1529
1754 1307
1428 1415
1504 1969
1710 1220
1240 1212
1197 1555...

result:

ok Accepted with 0+4000 operations,sum of size(s)=0+0

Test #46:

score: 11
Accepted
time: 2ms
memory: 4656kb

input:

5
1256148136
50000 4000 200000 100000
999
2016310630 2016310917
2107471344 2107470258
3472709132 3472709188
289824693 289824187
968116627 968117102
254957789 254959335
3918543752 3918543310
3679196968 3679195694
2994473794 2994473552
4244660702 4244660526
1565613257 1565613765
4153244320 4153244472
...

output:

Succeeded
0 3996 0 0
1119 254
1348 894
140 115
382 1312
1968 1018
1197 1662
1523 1153
1223 1773
407 1100
896 1185
1752 587
231 1353
1281 156
1621 130
333 1292
1593 1990
256 1898
688 1565
1286 1564
1913 86
1317 409
142 1933
512 1884
1649 1098
742 749
1665 437
288 1924
422 997
945 1421
1447 1605
1554 ...

result:

ok Accepted with 0+3996 operations,sum of size(s)=0+0

Test #47:

score: 11
Accepted
time: 3ms
memory: 4592kb

input:

5
174080677
50000 4000 200000 100000
1000
3686639308 3686638800
2896535064 2896534994
942582287 942582342
1036404485 1036404700
2240524876 2240525002
885623407 885623800
2908065975 2908066813
132144926 132144327
4212166510 4212165968
2576925241 2576925211
2854923688 2854924082
4019207120 4019206802
...

output:

Succeeded
0 4000 0 0
559 727
515 135
952 626
888 981
965 971
939 928
86 679
99 478
1951 1
831 1154
932 491
137 974
922 732
271 129
432 258
1749 801
669 472
92 1274
295 266
1598 208
1087 867
1371 550
968 737
28 104
715 191
118 284
791 359
100 1345
568 641
820 136
728 884
374 556
705 11
389 446
534 53...

result:

ok Accepted with 0+4000 operations,sum of size(s)=0+0

Test #48:

score: 11
Accepted
time: 9ms
memory: 4436kb

input:

5
1245824305
50000 4000 200000 100000
1000
3667004853 3667004169
2287697139 2287696730
2209822990 2209823892
4121239467 4121237803
1095196087 1095194911
1774546551 1774545134
1362722072 1362721338
1986032138 1986033160
3134483043 3134484458
3770232965 3770233774
4150800332 4150798469
444018341 44401...

output:

Succeeded
43513 4000 43513 87026
843 1316
915 1793
397 1026
844 1085
958 1902
273 1449
795 1792
205 1890
534 1758
170 1040
581 1263
898 1876
621 1595
812 1016
791 1351
86 1765
887 1723
408 1177
744 1821
488 1923
996 1547
754 1381
74 1778
222 1627
767 1348
942 1142
215 1308
637 1152
275 1672
412 1770...

result:

ok Accepted with 43513+4000 operations,sum of size(s)=43513+87026

Test #49:

score: 11
Accepted
time: 9ms
memory: 4344kb

input:

5
1416201142
50000 4000 200000 100000
999
2694326229 2694325190
3006267026 3006266271
3590771525 3590772511
382357401 382355920
3477874958 3477875914
653232151 653234151
4226125318 4226123972
2278771395 2278772384
2110222591 2110223909
3320640593 3320639898
2013976833 2013977782
2032673776 203267476...

output:

Succeeded
43441 3996 43441 86882
788 1000
982 1982
981 1802
323 1397
465 1832
180 1023
567 1249
968 1506
92 1095
241 1723
75 1186
781 1295
954 1401
141 1609
440 1903
922 1614
447 1889
605 1525
456 1221
210 1784
897 1391
105 1534
439 1543
512 1415
271 1623
802 1225
795 1812
364 1298
386 1647
285 1748...

result:

ok Accepted with 43441+3996 operations,sum of size(s)=43441+86882

Subtask #6:

score: 7.84911
Acceptable Answer

Test #50:

score: 12
Accepted
time: 3ms
memory: 4352kb

input:

6
889180297
25000 4000 200000 100000
998
3680334935 3680334330
2957217208 2957215867
3096097757 3096097331
2843029536 2843030717
2270437916 2270437982
1841161075 1841160444
3671823118 3671823208
2166904224 2166903071
2760262295 2760263328
880472976 880472564
3147819342 3147820514
3366602035 33666019...

output:

Succeeded
21475 3992 21475 42950
1790 1670
1835 346
957 1325
1646 1027
1811 6
826 1232
1467 119
1922 1994
1622 1106
1031 1440
1489 125
1429 1930
1686 1888
787 576
1426 1339
34 1410
1541 1180
72 911
1982 809
1320 903
598 144
360 430
1792 1705
112 1839
1474 1334
491 744
99 971
1808 31
1043 1370
1521 1...

result:

ok Accepted with 21475+3992 operations,sum of size(s)=21475+42950

Test #51:

score: 7.84911
Acceptable Answer
time: 6ms
memory: 4356kb

input:

6
1393953829
25000 4000 200000 100000
999
945306191 945306676
862749063 862750710
1587703663 1587703760
2321904837 2321905131
3322741249 3322741330
128629140 128628755
4061072808 4061073316
3009230812 3009229891
3626184675 3626183179
3701144497 3701145089
1334455826 1334454368
3195102134 3195101407
...

output:

Succeeded
29562 3996 29562 59124
1981 163
276 396
1196 350
1203 529
775 415
1246 1429
1179 644
56 1860
1831 1342
1985 658
1091 674
1735 559
495 1023
1564 1061
1078 1150
1550 1166
1451 1913
167 171
112 197
1687 169
1315 1996
225 485
1144 929
165 422
1763 1940
1295 391
1645 1408
936 938
158 729
963 22...

result:

points 0.65409273760 Accepted with 29562+3996 operations,sum of size(s)=29562+59124

Test #52:

score: 12
Accepted
time: 4ms
memory: 4428kb

input:

6
2137907583
25000 4000 200000 100000
1000
99249012 99249101
3089074242 3089075163
3142929261 3142928885
3509452069 3509452074
4100326210 4100325388
2027856240 2027856707
1667832698 1667832002
239393593 239393607
3323558397 3323558267
87270863 87271227
2749644672 2749644377
3753692402 3753692989
671...

output:

Succeeded
9519 4000 9519 19038
724 988
625 560
365 825
353 442
1935 1732
1895 1089
280 1119
431 936
784 918
611 793
498 173
901 98
701 429
295 675
873 31
412 359
157 982
309 215
584 617
530 446
350 103
715 311
1617 1677
1417 1395
926 1987
727 752
402 102
1613 1408
1604 1428
1187 1532
1081 1866
1748 ...

result:

ok Accepted with 9519+4000 operations,sum of size(s)=9519+19038

Test #53:

score: 12
Accepted
time: 4ms
memory: 4460kb

input:

6
620581501
25000 4000 200000 100000
999
2430495051 2430494760
2342044260 2342044349
4168624383 4168624716
4153034330 4153033041
113541062 113539588
3734354027 3734355235
204355212 204355044
2304848470 2304848423
2783072361 2783073753
431065913 431066151
800004122 800004842
3667276533 3667275783
229...

output:

Succeeded
10010 3996 10010 20020
1012 1083
1114 1133
1252 1258
1271 1367
1386 1392
1407 1425
1066 1069
1105 1110
1196 1274
1362 1388
1394 1432
1453 1482
1509 1573
1577 1626
1631 1653
1658 1710
1715 1804
1871 1907
1975 1488
1462 1522
1619 1683
220 780
926 61
158 251
281 803
573 671
434 549
1004 1007
...

result:

ok Accepted with 10010+3996 operations,sum of size(s)=10010+20020

Test #54:

score: 12
Accepted
time: 4ms
memory: 4592kb

input:

6
1540179210
25000 4000 200000 100000
998
908025469 908025772
4110515646 4110516139
1434161137 1434160239
4210047633 4210047681
2756906765 2756906979
773613891 773613906
3984390566 3984390788
1117864605 1117864853
379534092 379533510
3317517762 3317518164
1919343058 1919344136
1048781877 1048782644
...

output:

Succeeded
16965 3992 16965 33930
4 7
6 78
105 154
57 166
200 202
127 686
861 714
979 275
208 332
508 535
542 611
659 664
678 690
758 834
882 98
973 568
415 473
710 210
209 211
22 23
83 84
123 137
161 194
253 356
417 454
519 555
584 597
651 671
681 682
683 688
738 745
794 814
820 826
926 964
628 961
...

result:

ok Accepted with 16965+3992 operations,sum of size(s)=16965+33930

Test #55:

score: 12
Accepted
time: 4ms
memory: 4384kb

input:

6
218843024
25000 4000 200000 100000
1000
4003665165 4003664581
989541263 989541162
1710766055 1710765338
3659822362 3659822800
2654208269 2654208393
1491873748 1491873450
1160537498 1160536441
3762298781 3762298020
3903551469 3903551390
4248337091 4248336400
1517118005 1517118186
399918797 39991852...

output:

Succeeded
14751 4000 14751 29502
511 556
741 501
10 72
457 227
946 843
21 657
889 834
936 892
472 821
623 68
614 559
83 168
124 81
74 159
208 310
325 584
594 708
714 748
891 895
599 686
427 711
152 661
646 547
96 636
214 901
204 531
329 805
113 446
128 675
989 320
123 662
682 610
918 516
933 963
32 ...

result:

ok Accepted with 14751+4000 operations,sum of size(s)=14751+29502

Test #56:

score: 12
Accepted
time: 5ms
memory: 4392kb

input:

6
846170590
25000 4000 200000 100000
998
1218684893 1218683879
1552665572 1552664853
3443478269 3443477570
1790763876 1790763016
1025362073 1025360149
2654707482 2654705839
1494316579 1494316380
2068116991 2068116277
331974024 331973737
1788075132 1788074334
953158534 953158009
586401169 586400597
2...

output:

Succeeded
18457 3992 18457 36914
1036 1397
1692 1448
1767 1374
1650 1499
1780 1384
1657 1805
1410 1291
1514 1695
1520 1235
1606 1026
1558 1388
1105 1296
1548 1037
1364 1380
1491 1069
1438 1150
2 55
59 72
77 206
211 236
244 286
321 341
1030 1138
1147 1248
1270 1346
1554 1597
1667 1806
1956 1972
1983 ...

result:

ok Accepted with 18457+3992 operations,sum of size(s)=18457+36914

Test #57:

score: 12
Accepted
time: 4ms
memory: 4392kb

input:

6
681304959
25000 4000 200000 100000
999
2726760615 2726761129
4070002268 4070002314
2698967410 2698967313
3149535258 3149536218
3426049564 3426049397
1255425746 1255425945
273472210 273471617
432940843 432940957
539629098 539628555
625817515 625817025
2355613233 2355613594
10360141 10360443
3239718...

output:

Succeeded
14550 3996 14550 29100
1268 1545
1779 1791
1559 1453
1914 1470
1963 1626
1325 1592
1516 1671
1686 1454
1314 1610
1625 1684
1308 1478
1111 1855
1138 1891
1737 1744
1974 1413
1052 1053
1687 1225
1236 1669
1579 1826
1319 1025
1072 1182
1697 1435
1320 1392
1829 1997
1471 1538
1460 1450
1011 13...

result:

ok Accepted with 14550+3996 operations,sum of size(s)=14550+29100

Test #58:

score: 9.2426
Acceptable Answer
time: 5ms
memory: 4356kb

input:

6
1240372772
25000 4000 200000 100000
1000
1759289079 1759288926
1933352834 1933352077
347838835 347839028
2202749992 2202750871
3939036060 3939035178
3009870817 3009869983
3748040393 3748040424
864310002 864310105
1129152802 1129153119
718780908 718780600
1884330497 1884330296
2050569859 2050569350...

output:

Succeeded
26119 4000 26119 52238
4 5
8 10
15 17
25 40
47 62
66 68
87 92
96 104
122 124
145 148
150 156
161 188
209 215
221 224
225 226
227 229
242 245
246 248
268 275
277 288
289 302
304 306
307 315
321 332
333 348
350 370
385 386
395 398
405 410
414 418
425 438
441 445
448 456
458 468
479 515
518 5...

result:

points 0.77021686440 Accepted with 26119+4000 operations,sum of size(s)=26119+52238

Subtask #7:

score: 0
Wrong Answer

Test #59:

score: 0
Wrong Answer
time: 5ms
memory: 4240kb

input:

7
1561772597
25000 4000 200000 100000
1000
834919143 834919090
162625904 162627303
1067517190 1067517712
3410644901 3410644677
2728503196 2728502622
4133685425 4133685598
976760503 976760426
2101358026 2101358499
3583017242 3583017016
1743218912 1743220527
2609984627 2609985177
3915259025 3915259188...

output:

Failed
Limit of C1 exceeded

result:

wrong answer Limit of C1 exceeded

Subtask #8:

score: 0
Wrong Answer

Test #70:

score: 0
Wrong Answer
time: 26ms
memory: 5540kb

input:

8
1311447458
50000 100000 500000 200000
4999
173190562 173182163
1078196947 1078197142
1215565665 1215571165
1186082670 1186081354
2422459084 2422459806
2626070241 2626074599
207492448 207494582
2266700305 2266695214
1679673055 1679672568
3879988278 3879982030
254940475 254941572
3919251618 39192495...

output:

Failed
Limit of C1 exceeded

result:

wrong answer Limit of C1 exceeded

Subtask #9:

score: 0
Wrong Answer

Test #81:

score: 0
Wrong Answer
time: 16ms
memory: 5604kb

input:

9
574951428
15000 10000 200000 50000
5000
1781472251 1781466624
803445324 803444785
3544280892 3544283003
3151400420 3151403948
3250864128 3250871501
4189507543 4189510374
3483519516 3483520446
1003612935 1003617460
1101934749 1101931586
1948046579 1948042301
4151407804 4151401951
424123439 42412196...

output:

Failed
Limit of C1 exceeded

result:

wrong answer Limit of C1 exceeded