QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253707#7791. 通道建设 Passage Constructionhos_lyric#17.457929 45ms5908kbC++143.5kb2023-11-17 12:10:412024-07-04 02:26:06

Judging History

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

  • [2024-07-04 02:26:06]
  • 评测
  • 测评结果:17.457929
  • 用时:45ms
  • 内存:5908kb
  • [2023-11-17 12:10:41]
  • 提交

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(62);

int N, Subtask;
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_;
  Subtask = getSubtaskID();
  const int rt = (Subtask == 4 || Subtask == 6) ? (N + 1 + rng() % N) : (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 (Subtask == 4 || Subtask == 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: 1ms
memory: 3940kb

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: 1ms
memory: 3968kb

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: 1ms
memory: 3968kb

input:

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

output:

Succeeded
0 8 0 0
1 3
4 2

result:

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

Test #4:

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

input:

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

output:

Succeeded
0 12 0 0
3 2
1 4
5 6

result:

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

Test #5:

score: 3
Accepted
time: 1ms
memory: 3900kb

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
1 6
7 3
8 4
5 2

result:

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

Test #6:

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

input:

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

output:

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

result:

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

Test #7:

score: 3
Accepted
time: 1ms
memory: 3912kb

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: 3912kb

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
3 20 3 6
2 6
1 3
7 10
5 8
9 4

result:

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

Test #9:

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

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: 1ms
memory: 3900kb

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
2 20 2 4
6 2
1 8
9 3
7 10
5 4

result:

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

Subtask #2:

score: 6
Accepted

Test #11:

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

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
1366 400 1366 2732
16 2
127 174
9 60
28 45
88 58
133 17
29 82
27 59
64 122
41 47
71 13
76 20
57 163
170 18
137 23
30 68
63 149
144 165
1 31
70 97
79 65
138 173
6 145
53 121
198 33
10 183
35 55
21 80
83 175
135 75
67 107
37 54
62 131
93 90
44 114
85 134
124 150
158 166
116 22
14 119
142 87
...

result:

ok Accepted with 1366+400 operations,sum of size(s)=1366+2732

Test #12:

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

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
1088 392 1088 2176
107 153
6 50
123 94
88 37
46 52
18 62
30 73
40 187
81 121
2 98
111 169
145 176
10 56
57 48
71 47
22 51
131 127
93 182
161 104
85 19
102 190
83 189
59 100
76 109
20 188
7 79
35 54
77 125
9 75
158 152
135 58
132 183
142 67
21 118
24 134
155 164
15 140
157 95
105 138
106 18...

result:

ok Accepted with 1088+392 operations,sum of size(s)=1088+2176

Test #13:

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

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
692 396 692 1384
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 692+396 operations,sum of size(s)=692+1384

Test #14:

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

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
605 396 605 1210
159 28
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
176 83
143 192
4 9
68 74
75 124
156 12
59 72
32 80
184 5
137 139
51 149
126 162
3 195
17 177
27 196
101 102
161 120
111 182
133 134
117 112
105 118
132 140
109...

result:

ok Accepted with 605+396 operations,sum of size(s)=605+1210

Test #15:

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

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
938 400 938 1876
44 68
113 118
153 168
181 119
116 129
190 147
173 130
106 121
160 200
144 138
101 120
175 136
140 164
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
...

result:

ok Accepted with 938+400 operations,sum of size(s)=938+1876

Test #16:

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

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
598 400 598 1196
176 57
19 31
137 95
74 22
3 29
196 87
27 104
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
147 52
132 149
156 17
45 82
200 11
36 131
140 91
117 130
193 84
126 43
146 111
13 166
8 38
1 7
108 138...

result:

ok Accepted with 598+400 operations,sum of size(s)=598+1196

Test #17:

score: 6
Accepted
time: 0ms
memory: 4008kb

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
540 388 540 1080
5 66
9 96
132 136
141 46
100 155
118 165
160 193
174 45
88 164
102 163
111 172
187 4
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
120 157
14 26
151 154
12 34
170 169
175...

result:

ok Accepted with 540+388 operations,sum of size(s)=540+1080

Test #18:

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

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
1284 392 1284 2568
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
110 119
175 75
157 100
21 36
185 190
14 67
81 89
8 39
6 51
56 65
134 45
27 38
80 156
3 46
88 53
192 57
62 72
178 183
149 99
137 173
125 108
161 133
104 115
150 167
191 169
127 128
...

result:

ok Accepted with 1284+392 operations,sum of size(s)=1284+2568

Subtask #3:

score: 0
Runtime Error

Test #19:

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

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: 2ms
memory: 4560kb

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
198 827
112 795
703 616
809 427
584 743
818 611
649 805
42 438
1863 330
1562 251
922 322
1460 130
723 928
868 579
606 701
641 761
711 339
60 786
581 237
759 256
502 651
634 368
1878 340
491 118
1638 924
6 411
437 224
529 484
1 171
617 435
828 876
893 549
160 62
364 94
765 942
50...

result:

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

Test #21:

score: 8
Accepted
time: 4ms
memory: 4656kb

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
1700 1624
1499 1436
1498 1268
1759 1326
1659 1857
1293 1920
1651 1242
1523 1311
1751 1687
1336 1347
1810 1021
1366 1147
1006 1784...

result:

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

Test #22:

score: 0
Runtime Error

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:

Unauthorized output

result:


Subtask #4:

score: 0
Checker Judgement Failed

Test #29:

score: 9
Accepted
time: 8ms
memory: 4404kb

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
12367 4000 12367 24734
1503 1406
852 186
1707 1207
1595 895
468 407
1226 753
513 55
1337 263
1357 440
1492 1615
1996 1828
1658 1139
1438 1824
133 975
613 754
1006 1943
1735 1940
1322 1283
1829 1529
1221 1861
1746 532
1614 1526
1275 1165
265 732
1284 1749
524 1143
1617 1373
640 38
1835 606
...

result:

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

Test #30:

score: 0
Checker Judgement Failed

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
4223 4000 4223 8446
1981 1097
1743 1453
1616 1862
1947 1969
1176 1747
1625 1208
1286 1379
1526 1005
1493 1168
1381 1531
1895 1757
1610 1575
1124 1214
1131 1207
1457 1788
1323 1750
1303 1338
1018 352
200 562
206 930
592 614
286 630
465 647
427 907
170 93
599 260
776 159
972 713
581 550
84 4...

result:


Subtask #5:

score: 0
Checker Judgement Failed

Test #39:

score: 0
Checker Judgement Failed

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
39015 3992 39015 78030
1908 1015
1016 1260
1523 1468
1410 1228
1989 1059
1269 1750
1174 1205
1120 1898
1527 1068
1685 1160
1936 1365
1910 1493
1327 1537
1641 1771
1548 949
1947 774
1319 839
1462 1102
1599 1686
1009 1183
1080 1596
486 970
1446 569
260 644
1547 1619
439 654
48 91
616 1078
13...

result:


Subtask #6:

score: 8.45793
Acceptable Answer

Test #50:

score: 12
Accepted
time: 9ms
memory: 4476kb

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
16699 3992 16699 33398
1266 842
329 396
1187 148
1733 291
880 1091
1206 1545
1336 275
1548 1558
1498 1606
1390 790
713 1538
1470 1950
800 1153
1156 1416
1676 336
14 488
479 586
1799 348
1851 306
1241 819
434 39
694 71
1231 1649
1881 455
104 1661
1740 261
1770 165
601 1894
988 1794
331 1751...

result:

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

Test #51:

score: 8.45793
Acceptable Answer
time: 3ms
memory: 4368kb

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
28023 3996 28023 56046
1722 243
1103 1005
1423 1646
1055 1991
1347 213
715 745
1117 1741
1918 504
1757 1526
1140 1924
1664 804
117 421
670 518
211 108
312 618
1406 1522
1960 159
1358 205
686 173
1599 1754
420 268
1351 616
30 155
1298 129
1667 414
1258 647
1270 1389
1978 175
1837 939
1011 1...

result:

points 0.70482741160 Accepted with 28023+3996 operations,sum of size(s)=28023+56046

Test #52:

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

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
7987 4000 7987 15974
64 147
154 241
251 272
343 425
1 57
75 171
200 202
322 413
292 334
872 316
361 545
559 581
640 667
694 709
731 922
1473 1317
1129 1216
1585 1062
1790 1955
1278 1746
1788 991
956 471
789 145
112 163
177 333
356 374
445 473
1614 567
585 595
1365 1733
1396 1015
1124 1717
...

result:

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

Test #53:

score: 12
Accepted
time: 7ms
memory: 4668kb

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
9999 3996 9999 19998
764 150
950 102
511 133
1008 1013
1018 1021
1036 1045
1047 1056
1064 1080
1092 1094
1102 1108
1154 1160
1166 1178
1179 1192
1281 1284
1293 1298
1303 1328
1330 1331
1334 1348
1042 1123
1171 1325
1549 1606
1778 1947
1351 1375
1381 1395
1399 1434
1438 1512
1539 1542
1084 ...

result:

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

Test #54:

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

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
17049 3992 17049 34098
1218 1444
1685 1215
1128 1453
1105 1980
1112 1110
1845 1068
1550 1725
1294 1804
1616 1860
1564 1356
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 ...

result:

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

Test #55:

score: 12
Accepted
time: 8ms
memory: 4356kb

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
15388 4000 15388 30776
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 15388+4000 operations,sum of size(s)=15388+30776

Test #56:

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

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
17608 3992 17608 35216
1036 1397
1692 1448
1767 1374
1650 1499
1780 1384
1657 1805
1410 1291
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 368
377 411
8 26
43 45
178 212
213 253
290 335
349 407
25 37
42 49
1021 1047
111...

result:

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

Test #57:

score: 12
Accepted
time: 7ms
memory: 4360kb

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
11716 3996 11716 23432
1479 1940
1379 1483
1201 1608
1802 1837
1533 1707
1480 1037
1735 1010
1718 1252
1093 1781
1996 1913
1126 1200
1123 1818
1068 1291
1702 1995
1033 1049
1346 1831
1441 1185
1040 1646
1712 1178
1338 1357
1561 1690
1560 1710
1353 1568
1984 1824
1202 1464
1949 1489
1297 10...

result:

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

Test #58:

score: 8.55249
Acceptable Answer
time: 10ms
memory: 4424kb

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
27789 4000 27789 55578
1132 1263
1162 1526
1102 1667
1135 1222
1380 1874
1892 1088
1153 1161
1844 1392
1217 1723
1171 1189
1724 1258
1341 1765
1410 1437
1538 1695
1247 1683
1119 1422
1655 1630
1995 1654
1366 1967
1714 1984
1074 1849
1492 1751
1821 1233
1062 1238
1359 1948
1024 1315
1104 14...

result:

points 0.71270740840 Accepted with 27789+4000 operations,sum of size(s)=27789+55578

Subtask #7:

score: 0
Wrong Answer

Test #59:

score: 0
Wrong Answer
time: 10ms
memory: 4436kb

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: 45ms
memory: 5668kb

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: 27ms
memory: 5908kb

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