QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#403967#437. Fun Tourbachbeo200747 151ms23436kbC++232.1kb2024-05-03 00:20:342024-05-03 00:20:35

Judging History

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

  • [2024-05-03 00:20:35]
  • 评测
  • 测评结果:47
  • 用时:151ms
  • 内存:23436kb
  • [2024-05-03 00:20:34]
  • 提交

answer

#include "fun.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> createFunTour(int N, int Q) {
    vector<int> P(N);
    int X=0,Min=N;
    for(int i=0;i<N;i++){
        int sz=attractionsBehind(0,i);
        if(sz>N/2 && sz<Min) X=i,Min=sz;
    }
    vector<int> D(N),cc;
    for(int i=0;i<N;i++){
        D[i]=hoursRequired(X,i);
        if(D[i]==1) cc.push_back(i);
    }
    int S=(int)cc.size();
    vector<vector<int>> G(S);
    for(int i=0;i<N;i++){
        if(i==X) continue;
        int j=0;
        while(j+1<S && hoursRequired(cc[j],i)+D[cc[j]]!=D[i]) j++;
        G[j].push_back(i);
        //cout << j << ' ' << i << '\n';
    }
    for(int i=0;i<S;i++){
        sort(G[i].begin(),G[i].end(),[&](int x,int y){
            return D[x]<D[y];
        });
    }
    //cout << X << '\n';
    int T=0;
    vector<int> A,B;
    if(S==2){
        A=G[0];B=G[1];
        if((int)A.size()>(int)B.size()) swap(A,B);
    }
    else{
        int c=-1;
        while(T<N-1){
            int Max=0;
            for(int i=0;i<S;i++) Max=max(Max,(int)G[i].size());
            if(2*Max==N-T-1) break;
            int u=-1;Max=0;
            for(int i=0;i<S;i++){
                if(c==i) continue;
                if(D[G[i].back()]>Max) Max=D[G[i].back()],u=i;
            }
            P[T++]=G[u].back();
            G[u].pop_back();c=u;
        }
        int u=-1;
        for(int i=0;i<S;i++) if(2*(int)G[i].size()==N-T-1) u=i;

        for(int i=0;i<S;i++){
            if(u==i) A=G[i];
            else B.insert(B.end(),G[i].begin(),G[i].end());
        }
        if(c!=u) swap(A,B);
        sort(A.begin(),A.end(),[&](int x,int y){
            return D[x]<D[y];
        });
        sort(B.begin(),B.end(),[&](int x,int y){
            return D[x]<D[y];
        });
        assert((int)A.size()==(int)B.size());
    }
    while(!A.empty() || !B.empty()){
        if(!B.empty()) P[T++]=B.back(),B.pop_back();
        if(!A.empty()) P[T++]=A.back(),A.pop_back();
    }
    P[T++]=X;
    //for(int i=0;i<N;i++) cout << P[i] << ' ';
    //cout << '\n';
    return P;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

2 400000
1 0

output:

1 0

result:

ok correct

Test #2:

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

input:

3 400000
1 0
2 0

output:

2 1 0

result:

ok correct

Subtask #2:

score: 0
Accepted

Test #3:

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

input:

4 400000
1 0
2 0
3 1

output:

3 2 1 0

result:

ok correct

Test #4:

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

input:

9 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3

output:

6 8 5 7 2 4 0 3 1

result:

ok correct

Test #5:

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

input:

14 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6

output:

10 13 9 12 8 11 7 6 4 5 3 2 1 0

result:

ok correct

Test #6:

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

input:

15 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6

output:

14 10 13 9 12 8 11 7 6 4 5 3 2 1 0

result:

ok correct

Test #7:

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

input:

16 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7

output:

15 14 10 13 9 12 8 11 7 6 4 5 3 2 1 0

result:

ok correct

Test #8:

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

input:

17 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7

output:

14 16 13 15 12 10 11 9 6 8 5 7 2 4 0 3 1

result:

ok correct

Subtask #3:

score: 0
Accepted

Test #9:

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

input:

4 400000
1 0
2 1
3 2

output:

3 0 2 1

result:

ok correct

Test #10:

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

input:

12 400000
5 4
6 5
7 6
10 9
8 10
11 8
7 11
3 7
2 3
1 2
0 1

output:

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

result:

ok correct

Test #11:

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

input:

17 400000
1 2
3 1
4 3
5 4
6 5
8 9
10 8
11 12
10 11
7 10
6 7
13 6
14 13
15 14
0 15
16 0

output:

2 16 1 12 0 9 3 11 15 8 4 10 14 7 13 5 6

result:

ok correct

Test #12:

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

input:

17 400000
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15

output:

16 0 15 1 14 2 13 3 12 4 11 5 10 6 9 7 8

result:

ok correct

Subtask #4:

score: 0
Accepted

Test #13:

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

input:

4 400000
0 1
0 2
0 3

output:

1 3 2 0

result:

ok correct

Test #14:

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

input:

17 400000
6 4
3 6
8 3
7 8
13 7
15 13
2 15
11 2
14 11
9 14
5 9
1 5
12 1
10 12
16 10
0 16

output:

0 4 16 6 10 3 12 8 1 7 5 13 9 15 14 2 11

result:

ok correct

Test #15:

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

input:

17 400000
11 3
9 3
10 11
13 11
16 9
5 9
4 10
1 10
14 13
2 13
8 16
0 16
6 5
12 5
7 4
15 4

output:

12 15 8 7 6 14 0 2 16 4 5 1 9 13 3 10 11

result:

ok correct

Test #16:

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

input:

14 400000
1 11
3 1
2 3
8 2
9 8
13 8
12 13
0 12
5 13
10 5
4 10
7 11
6 7

output:

6 4 7 10 11 0 1 12 3 5 9 13 2 8

result:

ok correct

Test #17:

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

input:

15 400000
9 12
13 9
1 13
11 1
0 11
2 0
6 0
4 6
10 4
14 6
7 14
8 10
5 10
3 5

output:

12 3 9 8 13 5 1 7 11 10 2 14 0 4 6

result:

ok correct

Test #18:

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

input:

16 400000
2 6
8 2
12 6
0 12
13 0
1 13
10 1
5 10
14 0
9 10
15 9
11 15
3 11
4 3
7 3

output:

7 8 4 2 3 6 11 14 15 12 9 0 5 13 10 1

result:

ok correct

Test #19:

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

input:

17 400000
8 11
6 8
3 6
9 3
14 9
2 14
16 14
0 3
13 2
1 13
10 1
12 1
7 10
4 7
5 7
15 5

output:

11 15 8 5 6 4 0 7 3 12 16 10 9 1 14 13 2

result:

ok correct

Subtask #5:

score: 0
Accepted

Test #20:

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

input:

18 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8

output:

14 17 13 16 12 15 11 8 6 7 5 10 2 9 3 4 0 1

result:

ok correct

Test #21:

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

input:

27 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12

output:

26 18 25 17 24 16 23 15 14 22 13 21 12 20 11 19 6 8 5 7 10 2 9 3 4 0 1

result:

ok correct

Test #22:

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

input:

31 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14

output:

30 22 29 21 28 20 27 19 26 18 25 17 24 16 23 15 14 10 13 9 12 8 11 7 6 4 5 3 2 1 0

result:

ok correct

Test #23:

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

input:

500 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

413 285 414 284 415 283 416 282 417 281 418 280 419 279 420 278 421 277 422 276 423 275 424 274 425 273 441 272 427 271 428 286 429 269 430 268 431 267 432 266 433 265 434 264 435 263 436 262 437 261 438 260 439 259 440 258 426 257 383 256 384 255 385 270 386 317 387 316 388 315 389 314 390 313 391 ...

result:

ok correct

Test #24:

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

input:

33 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15

output:

30 32 29 31 28 22 27 21 26 20 25 19 24 18 23 17 14 16 13 15 12 10 11 9 6 8 5 7 2 4 0 3 1

result:

ok correct

Test #25:

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

input:

119 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

95 63 96 64 97 65 98 66 99 67 100 68 101 69 102 70 103 71 104 72 105 73 106 74 117 75 116 76 115 77 114 78 113 79 112 80 111 81 110 82 109 83 108 84 118 85 107 86 54 87 47 88 48 89 49 90 50 91 51 92 52 93 53 94 55 31 56 32 57 33 58 34 60 36 61 37 62 38 59 35 23 39 24 40 25 41 26 42 28 44 29 45 30 46...

result:

ok correct

Test #26:

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

input:

174 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

95 127 96 128 97 129 98 130 99 131 100 132 101 133 102 134 103 135 104 136 105 137 106 138 107 139 108 140 109 141 110 142 125 157 124 156 123 155 122 154 121 153 120 152 119 151 118 150 117 149 116 148 115 147 114 146 113 145 112 144 126 158 111 143 47 159 48 160 49 161 50 162 51 163 52 164 53 165 ...

result:

ok correct

Subtask #6:

score: 0
Accepted

Test #27:

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

input:

18 400000
7 6
8 7
5 8
4 5
3 4
9 3
10 11
12 10
13 12
14 13
9 14
2 9
15 2
16 15
17 16
1 17
0 1

output:

0 6 1 7 11 17 8 10 16 5 12 15 4 13 3 14 2 9

result:

ok correct

Test #28:

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

input:

500 400000
8 7
9 8
9 10
11 9
13 12
13 14
15 13
15 16
11 15
17 11
20 19
20 21
18 20
22 18
24 23
24 25
26 24
28 27
26 28
22 26
17 22
29 17
30 31
32 30
33 34
32 33
35 32
37 36
38 39
37 38
35 37
40 35
29 40
41 29
42 41
43 42
45 44
45 46
47 45
49 48
49 50
47 49
51 47
53 52
53 54
55 53
57 56
57 58
55 57
5...

output:

499 305 498 245 0 269 497 247 496 301 156 299 154 249 152 297 74 251 77 294 148 253 79 292 146 255 144 243 81 288 142 257 140 286 72 284 70 260 158 281 160 264 68 279 162 219 66 277 164 275 166 267 64 273 62 271 170 290 172 221 83 335 106 223 108 332 110 225 102 330 112 227 100 327 114 229 116 325 1...

result:

ok correct

Test #29:

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

input:

59 400000
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 ...

output:

58 0 57 1 56 2 55 3 54 4 53 5 52 6 51 7 50 8 49 9 48 10 47 11 46 12 45 13 44 14 43 15 42 16 41 17 40 18 39 19 38 20 37 21 36 22 35 23 34 24 33 25 32 26 31 27 30 28 29

result:

ok correct

Test #30:

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

input:

204 400000
13 12
13 14
15 13
16 17
15 16
18 15
20 19
20 21
22 20
23 24
22 23
18 22
11 18
25 11
26 25
27 26
28 27
10 28
9 10
8 9
7 8
29 7
32 31
30 32
29 30
33 29
6 33
34 6
35 34
5 35
36 5
4 36
37 4
48 47
48 49
50 48
51 50
53 52
54 53
56 55
54 56
51 54
57 51
59 58
59 60
61 59
63 62
61 63
64 61
66 65
6...

output:

24 116 21 114 12 112 14 120 17 110 19 122 23 108 13 106 16 126 20 104 22 101 15 131 18 91 11 99 25 93 26 134 27 97 65 136 67 129 47 138 62 95 60 140 58 147 55 149 70 151 49 156 52 158 28 160 59 162 10 164 63 166 66 168 69 170 53 173 48 176 56 179 68 191 54 193 31 189 61 145 9 183 50 195 51 187 64 18...

result:

ok correct

Test #31:

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

input:

273 400000
15 14
15 16
17 15
19 18
19 20
17 19
21 17
23 22
23 24
25 23
21 25
26 21
28 27
28 29
30 28
32 31
32 33
30 32
34 30
36 35
36 37
38 36
40 39
40 41
38 40
34 38
26 34
13 26
42 13
43 42
12 43
11 12
10 11
44 10
9 44
45 9
46 47
45 46
8 45
48 8
50 51
49 50
52 49
48 52
7 48
6 7
53 6
58 59
60 58
61 ...

output:

246 22 244 24 242 27 240 29 235 31 233 33 231 35 229 39 227 41 225 37 223 20 248 14 217 18 215 16 213 132 209 130 207 128 205 126 202 122 200 77 198 119 195 117 192 115 221 79 258 113 262 111 256 134 254 109 190 107 188 105 252 103 260 83 250 101 184 99 222 96 261 85 218 94 191 92 214 87 211 81 194 ...

result:

ok correct

Test #32:

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

input:

136 400000
19 18
19 20
17 19
16 17
15 16
14 15
21 14
22 21
13 22
23 13
12 23
24 12
11 24
10 11
9 10
8 9
7 8
6 7
25 6
26 25
5 26
4 5
27 4
28 27
29 28
40 39
40 41
42 40
44 43
44 45
42 44
46 42
47 48
49 47
51 50
51 52
49 51
46 49
53 46
55 54
56 55
57 56
58 59
60 58
62 61
62 63
60 62
57 60
53 57
64 53
6...

output:

20 54 18 39 19 59 17 52 16 61 15 63 14 50 21 65 22 67 13 69 23 45 12 71 24 43 11 74 10 41 9 48 8 79 7 81 6 83 25 85 0 87 26 89 5 91 1 94 135 96 4 98 2 100 27 105 28 107 3 109 29 112 134 120 30 125 31 114 133 102 132 118 131 123 32 47 130 55 129 90 33 111 128 108 34 82 51 115 44 104 40 124 58 78 75 1...

result:

ok correct

Subtask #7:

score: 0
Accepted

Test #33:

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

input:

500 400000
33 414
398 33
254 398
400 254
376 400
302 376
466 302
362 466
301 362
267 301
417 267
413 417
14 413
305 14
353 305
83 353
227 83
57 227
446 57
406 446
154 406
336 154
195 336
405 195
264 405
76 264
203 76
459 203
178 459
72 178
296 72
488 296
404 488
60 404
156 60
393 156
108 393
216 108...

output:

414 212 33 88 398 124 254 399 400 190 376 10 302 366 466 234 362 432 301 28 267 188 417 237 413 64 14 268 305 39 353 349 83 345 227 125 57 70 446 276 406 420 154 369 336 48 195 211 405 482 264 8 76 22 203 487 459 9 178 230 72 339 296 95 488 340 404 50 60 102 156 174 393 47 108 461 216 424 106 181 31...

result:

ok correct

Test #34:

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

input:

500 400000
243 472
21 472
171 243
31 243
419 21
366 21
474 171
246 171
363 31
201 31
317 419
458 419
59 366
7 366
417 474
394 474
351 246
191 246
431 363
202 363
397 201
81 201
28 317
237 317
71 458
221 458
239 59
429 59
0 7
60 7
418 417
18 417
240 394
341 394
440 351
485 351
373 191
487 191
261 431...

output:

242 249 238 252 236 254 234 260 231 273 222 285 220 286 219 291 218 359 325 307 206 310 205 332 200 334 199 338 186 340 176 347 172 348 165 357 158 296 207 2 324 37 320 39 314 43 312 56 309 77 306 105 302 110 300 128 295 217 251 139 281 140 279 144 278 154 274 169 272 179 264 196 262 209 257 213 255...

result:

ok correct

Test #35:

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

input:

500 400000
207 176
385 207
343 385
196 343
261 196
50 261
481 343
295 176
148 207
34 176
144 34
72 481
24 295
351 24
84 351
329 84
25 84
134 25
286 134
11 329
321 11
121 286
428 121
475 121
170 475
362 428
412 24
234 351
123 234
299 234
405 196
64 405
297 72
13 297
472 13
332 72
65 332
218 362
46 14...

output:

444 45 48 377 139 26 472 195 13 289 65 356 241 273 50 125 365 330 206 450 332 473 64 477 297 175 415 395 72 456 405 340 261 406 221 191 284 53 196 308 224 374 146 358 132 344 49 73 426 457 481 167 102 165 202 266 47 333 259 372 239 408 46 78 343 222 105 249 385 265 68 489 148 306 420 411 144 379 52 ...

result:

ok correct

Test #36:

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

input:

113 400000
78 45
67 45
40 67
25 40
54 67
3 54
44 54
70 3
15 25
37 15
11 15
27 11
102 37
110 102
97 110
41 97
31 41
9 11
24 9
87 24
46 24
84 46
109 46
95 27
49 97
101 49
71 49
94 41
29 25
55 29
99 55
22 55
17 99
33 17
75 33
60 33
32 70
63 32
88 63
39 32
51 39
36 88
57 51
19 57
65 19
50 65
26 51
43 26...

output:

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

result:

ok correct

Test #37:

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

input:

479 400000
217 361
375 361
370 217
138 217
393 138
297 138
263 297
119 263
202 119
247 202
376 247
285 376
101 285
236 101
351 285
409 351
197 409
11 236
97 11
122 409
189 122
391 189
232 391
88 391
160 197
272 160
313 272
335 313
14 97
193 88
410 193
116 193
348 11
341 348
281 335
198 281
455 410
4...

output:

388 306 67 468 149 415 73 37 93 439 363 252 109 170 372 469 378 68 65 460 276 222 242 162 102 84 29 124 133 324 259 179 441 362 151 307 176 167 258 209 142 22 371 403 296 432 268 381 99 16 126 464 111 79 233 434 39 54 472 31 412 128 274 369 256 42 141 419 205 360 303 219 13 315 451 422 41 200 156 25...

result:

ok correct

Test #38:

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

input:

269 400000
75 180
56 180
78 180
231 75
127 231
244 127
16 244
113 16
178 113
85 16
20 85
74 20
249 74
134 249
248 249
96 134
109 74
17 109
164 96
32 109
265 32
253 265
120 265
82 120
4 253
28 4
150 28
53 120
165 53
137 53
31 137
206 31
123 206
102 123
168 17
33 168
174 253
162 174
243 174
193 243
10...

output:

130 102 77 123 214 56 222 78 5 206 230 180 241 150 1 193 8 75 242 31 10 137 71 162 197 165 52 231 118 28 34 243 156 178 49 174 194 82 218 127 73 53 105 4 11 253 181 33 57 113 263 120 224 244 233 16 175 265 51 168 185 17 151 85 39 32 255 109 84 20 264 248 92 74 259 249 63 134 114 177 112 96 187 21 13...

result:

ok correct

Test #39:

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

input:

347 400000
305 85
97 305
161 97
125 161
200 125
317 200
140 317
211 140
88 161
174 88
256 174
135 256
148 135
272 148
116 272
269 116
228 272
131 228
141 131
327 135
232 327
43 232
191 43
313 191
80 313
150 80
214 150
23 214
126 80
215 126
10 215
156 10
1 156
79 10
284 79
114 284
316 156
335 316
119...

output:

165 211 55 140 268 317 90 85 328 200 281 305 221 97 234 141 189 125 242 269 46 131 219 161 183 88 206 116 11 228 245 272 9 174 177 148 170 256 322 135 338 327 134 232 20 43 28 23 182 122 199 273 323 191 308 214 168 169 107 222 262 150 324 313 157 187 180 334 159 80 343 152 146 114 84 17 61 171 236 2...

result:

ok correct

Test #40:

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

input:

189 400000
101 23
8 101
123 8
24 123
134 123
119 134
2 134
105 2
161 105
72 161
126 72
53 126
9 53
138 9
188 53
98 188
136 98
78 136
69 98
4 78
66 4
145 66
91 66
132 91
49 188
17 49
87 138
154 87
184 91
131 184
108 131
3 108
56 184
183 108
62 183
173 62
0 173
185 173
110 185
164 110
83 164
135 62
46...

output:

23 128 92 47 125 68 179 150 101 35 155 107 186 159 8 143 102 1 41 25 169 176 24 44 123 76 119 80 71 11 45 153 165 156 51 93 181 158 112 77 134 64 58 75 171 106 139 141 99 19 168 160 97 172 95 149 166 146 79 157 29 57 48 42 2 163 177 109 147 115 20 40 12 117 142 152 154 74 27 170 100 61 182 103 43 7 ...

result:

ok correct

Subtask #8:

score: 0
Accepted

Test #41:

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

input:

501 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

413 285 414 284 415 283 416 282 417 281 418 280 419 279 420 278 421 277 422 276 423 275 424 274 425 273 441 272 427 271 428 286 429 269 430 268 431 267 432 266 433 265 434 264 435 263 436 262 437 261 438 260 439 259 440 258 426 257 383 256 384 255 385 270 386 317 387 316 388 315 389 314 390 313 391 ...

result:

ok correct

Test #42:

score: 0
Accepted
time: 25ms
memory: 11800kb

input:

58961 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

52425 35487 52424 35488 52423 35489 52422 35490 52421 35491 52420 35492 52419 35493 52418 35494 54055 35495 52416 35496 52415 35497 52414 35498 52413 35499 52412 35500 52411 35501 52410 36862 52409 35503 52408 35504 52417 35505 52444 35506 52443 35507 52442 35508 52441 35509 52440 35510 52439 35511 ...

result:

ok correct

Test #43:

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

input:

511 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

415 287 416 288 417 289 418 290 419 291 420 292 421 293 422 294 423 295 424 296 425 297 426 298 427 299 428 300 429 301 446 318 431 303 432 304 433 305 434 306 435 307 436 308 437 309 438 310 439 311 440 312 441 313 442 314 443 315 444 316 445 317 430 302 383 255 384 256 385 257 386 258 387 259 388 ...

result:

ok correct

Test #44:

score: 0
Accepted
time: 49ms
memory: 17392kb

input:

100000 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 ...

output:

98861 71005 98862 71004 98863 71003 98864 71002 98865 71001 98866 71000 98867 70999 98868 70998 98869 70997 98870 70996 98871 70995 98872 70994 99151 70993 98874 70992 98875 70991 98876 73726 98877 70989 98878 70988 98879 70987 98880 70986 98881 70985 98882 70984 98883 70983 98884 70982 98885 70981 ...

result:

ok correct

Test #45:

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

input:

887 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

797 543 798 544 799 545 800 546 801 547 802 548 803 549 804 550 805 551 806 552 807 553 808 554 809 555 810 556 826 557 812 574 813 559 814 560 815 561 816 562 817 563 818 564 819 565 820 566 821 567 822 568 823 569 824 570 825 571 811 572 767 573 768 558 769 511 770 512 771 513 772 514 773 515 774 ...

result:

ok correct

Test #46:

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

input:

2027 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

1689 1117 1690 1116 1691 1115 1692 1114 1693 1113 1694 1112 1695 1111 1696 1110 1697 1109 1698 1108 1699 1107 1700 1106 1701 1105 1702 1104 1780 1103 1704 1150 1705 1101 1706 1100 1707 1099 1708 1098 1709 1097 1710 1096 1711 1095 1712 1094 1713 1093 1714 1092 1715 1091 1716 1090 1717 1089 1703 1088 ...

result:

ok correct

Test #47:

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

input:

3070 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

1695 2207 1696 2208 1697 2209 1698 2210 1699 2211 1700 2212 1701 2213 1702 2214 1703 2215 1704 2216 1705 2217 1706 2218 1707 2219 1708 2220 1709 2221 1790 2302 1711 2223 1712 2224 1713 2225 1714 2226 1715 2227 1716 2228 1717 2229 1718 2230 1719 2231 1720 2232 1721 2233 1722 2234 1723 2235 1724 2236 ...

result:

ok correct

Test #48:

score: 0
Accepted
time: 4ms
memory: 4212kb

input:

6956 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

6421 4445 6420 4444 6419 4443 6418 4442 6417 4441 6416 4440 6415 4439 6414 4438 6413 4437 6412 4436 6411 4435 6549 4434 6409 4433 6408 4432 6407 4431 6406 4606 6405 4429 6404 4428 6403 4427 6402 4426 6401 4425 6400 4424 6399 4423 6398 4422 6410 4421 6446 4420 6445 4419 6444 4418 6443 4417 6442 4416 ...

result:

ok correct

Test #49:

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

input:

13690 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

12748 8863 12749 8864 12750 8865 12751 8866 12752 8867 12753 8868 12754 8869 12755 8870 12756 8871 12988 8872 12758 8873 12759 8874 12760 8875 12761 8876 12762 8877 12763 9214 12764 8879 12765 8880 12766 8881 12767 8882 12757 8883 12726 8884 12727 8885 12728 8886 12729 8887 12730 8888 12731 8889 127...

result:

ok correct

Test #50:

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

input:

18091 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

13661 16944 13660 16945 13659 16946 13658 16947 13657 16948 13656 16949 13655 16950 13654 16951 13653 16952 13652 16953 13651 16954 13650 16955 13649 17236 13648 16957 13647 16958 14334 16959 13645 16960 13644 16961 13643 16962 13642 16963 13641 16964 13640 16965 13639 16966 13638 16967 13637 16968 ...

result:

ok correct

Subtask #9:

score: 0
Wrong Answer

Test #51:

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

input:

1000 400000
6 5
7 8
6 7
9 6
11 10
11 12
13 11
14 15
13 14
9 13
16 9
18 17
18 19
20 18
22 21
22 23
20 22
24 20
26 25
26 27
28 26
30 29
30 31
28 30
24 28
16 24
32 16
33 32
35 34
35 36
37 35
39 38
39 40
37 39
41 37
43 42
43 44
45 43
47 46
47 48
45 47
41 45
49 41
50 51
52 50
54 53
54 55
52 54
56 52
58 5...

output:

139 684 141 682 323 680 321 510 143 678 319 676 145 526 147 674 149 672 151 559 312 502 153 668 114 666 155 664 307 512 305 662 158 660 303 561 160 658 301 656 299 654 162 652 297 670 164 722 166 550 310 504 116 717 357 715 118 552 355 713 353 711 121 506 351 709 349 707 123 686 347 703 125 554 345 ...

result:

ok correct

Test #52:

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

input:

10000 400000
7 6
7 8
9 7
11 10
11 12
9 11
13 9
15 14
15 16
17 15
19 18
19 20
17 19
13 17
21 13
23 22
23 24
25 23
27 26
27 28
25 27
29 25
30 31
32 30
34 33
34 35
32 34
29 32
21 29
36 21
38 37
38 39
40 38
42 41
42 43
40 42
44 40
46 45
46 47
48 46
50 49
50 51
48 50
44 48
52 44
54 53
54 55
56 54
58 57
5...

output:

9708 967 9453 2214 9710 2216 9712 965 9451 2218 9714 963 9449 2220 9237 961 9235 959 9719 2225 9447 957 9799 2227 9443 955 9441 684 9726 2231 9439 953 9728 2233 9437 951 9730 2235 9732 2237 9435 949 9734 2239 9433 947 9736 2241 9445 2243 9678 945 9473 2245 9680 2229 9682 997 9471 2178 9684 995 9469 ...

result:

ok correct

Test #53:

score: 0
Accepted
time: 56ms
memory: 17776kb

input:

100000 400000
10 9
10 11
12 10
14 13
14 15
12 14
16 12
18 17
18 19
20 18
22 21
22 23
20 22
16 20
24 16
26 25
26 27
28 26
30 29
30 31
28 30
32 28
34 33
34 35
36 34
38 37
38 39
36 38
32 36
24 32
40 24
42 41
42 43
44 42
46 45
46 47
44 46
48 44
50 49
50 51
52 50
54 53
54 55
52 54
48 52
56 48
58 57
58 59...

output:

82546 25221 90617 37035 90614 37037 90612 25219 90610 37039 90608 25217 90606 37041 90604 22861 82548 25215 82550 37045 94150 25213 90597 37047 90595 37049 90593 25211 90591 37051 90589 25209 90587 37043 90585 25235 82552 37015 90582 25233 90580 37017 90599 37019 90661 25231 90659 37021 90657 37033 ...

result:

ok correct

Test #54:

score: 0
Accepted
time: 58ms
memory: 17316kb

input:

98793 400000
7 6
7 8
9 7
11 10
11 12
9 11
13 9
15 14
15 16
17 15
19 18
19 20
17 19
13 17
21 13
23 22
23 24
25 23
27 26
27 28
25 27
29 25
31 30
31 32
33 31
35 34
35 36
33 35
29 33
21 29
37 21
39 38
39 40
41 39
43 42
43 44
41 43
45 41
47 46
47 48
49 47
51 50
51 52
49 51
45 49
53 45
55 54
55 56
57 55
5...

output:

82049 12424 67726 12426 82051 12428 82053 12430 67724 12432 82055 12434 57359 12436 82057 18512 67722 12440 82059 12442 86795 12444 55392 12446 82063 12448 67720 12450 82065 12452 67718 12454 82067 12438 82069 12388 67716 12390 82071 12392 82073 12394 67714 12396 82061 12398 82023 12400 67740 12402 ...

result:

ok correct

Test #55:

score: 0
Accepted
time: 12ms
memory: 6724kb

input:

24452 400000
9 8
9 10
11 9
13 12
13 14
11 13
15 11
17 16
17 18
19 17
21 20
21 22
19 21
15 19
23 15
25 24
25 26
27 25
29 28
29 30
27 29
31 27
33 32
33 34
35 33
37 36
37 38
35 37
31 35
23 31
39 23
41 40
41 42
43 41
45 44
45 46
43 45
47 43
49 48
49 50
51 49
53 52
53 54
51 53
47 51
55 47
57 56
57 58
59 ...

output:

24451 3128 17955 544 17959 3126 17961 1798 17963 3124 17965 3122 17967 1800 17969 546 17971 3607 17973 3117 17975 1802 17977 3115 17979 924 17981 3113 17983 548 17985 3111 17987 1804 17989 3109 17991 3119 17993 1788 17995 3150 17997 3148 17999 538 18001 3146 18003 1790 18005 3144 18007 1792 18009 31...

result:

ok correct

Test #56:

score: 0
Accepted
time: 31ms
memory: 9640kb

input:

46432 400000
6 5
6 7
8 6
10 9
10 11
8 10
12 8
14 13
14 15
16 14
18 17
16 18
12 16
19 12
21 20
21 22
23 21
25 24
25 26
23 25
27 23
29 28
29 30
31 29
33 32
33 34
31 33
27 31
19 27
35 19
37 36
37 38
39 37
41 40
41 42
39 41
43 39
45 44
45 46
47 45
49 48
49 50
47 49
43 47
51 43
53 52
53 54
55 53
57 56
57...

output:

41012 4129 32983 10011 41014 10013 41016 4127 32981 10015 41018 4125 36902 10017 41020 10019 41022 4123 36900 10021 41024 4121 32979 10023 41026 10025 34207 4119 42524 10027 36898 2919 41030 10047 41032 4105 32977 10045 41034 4107 36896 10043 41036 10041 34209 4109 41038 4117 36894 4111 41040 10037 ...

result:

ok correct

Test #57:

score: 0
Accepted
time: 45ms
memory: 14248kb

input:

77532 400000
8 7
8 9
10 8
12 11
12 13
10 12
14 10
16 15
16 17
18 16
20 19
20 21
18 20
14 18
22 14
24 23
24 25
26 24
28 27
28 29
26 28
30 26
32 31
32 33
34 32
36 35
36 37
34 36
30 34
22 30
38 22
40 39
40 41
42 40
44 43
44 45
42 44
46 42
48 47
48 49
50 48
52 51
52 53
50 52
46 50
54 46
56 55
56 57
58 5...

output:

23095 50829 10630 50831 23097 50833 23099 50835 10628 50837 23101 50839 10626 50841 23103 50843 669 50845 23105 57987 23107 50849 10624 50851 23109 50853 10622 50855 23111 50857 23113 50859 10620 50861 23115 50863 930 50865 932 50847 23073 50789 23075 50791 10644 50793 23077 50795 10642 50797 23079 ...

result:

ok correct

Test #58:

score: -0
Wrong Answer
time: 2ms
memory: 4096kb

input:

4093 400000
12 11
12 13
14 12
16 15
14 16
17 14
18 19
20 18
22 21
22 23
20 22
17 20
24 17
26 25
26 27
28 26
30 29
30 31
28 30
32 28
34 33
34 35
36 34
38 37
38 39
36 38
32 36
24 32
40 24
42 41
42 43
44 42
44 45
46 44
47 48
49 47
51 50
51 52
49 51
46 49
53 46
55 54
55 56
57 55
59 58
59 60
57 59
61 57
...

output:

WA: Tour is not fun

result:

wrong output format Expected integer, but "WA:" found

Subtask #10:

score: 0
Runtime Error

Test #59:

score: 0
Accepted
time: 84ms
memory: 18512kb

input:

99999 400000
11681 58292
11681 63929
49752 11681
30596 74400
30596 39261
49752 30596
19390 49752
89694 31923
19390 89694
54297 19390
42389 12902
42389 60328
72803 42389
69881 43761
69881 95741
72803 69881
96271 72803
63872 20658
63872 93588
35833 63872
48418 44153
35833 48418
96271 35833
54297 96271...

output:

54185 62996 13388 26009 54193 62998 54198 26002 54199 26001 54200 63008 54204 25999 54210 63016 54212 63017 13385 25997 54217 25996 54218 73666 54226 63031 69843 63033 54232 63036 54238 25989 54243 63040 54244 25986 54247 25985 54250 63062 54252 63064 54253 63065 54255 63066 54258 25968 13383 63030 ...

result:

ok correct

Test #60:

score: 0
Accepted
time: 151ms
memory: 23436kb

input:

99999 400000
22911 42906
55177 22911
45848 55177
42077 45848
72422 42077
18572 72422
32391 18572
50776 32391
37509 50776
1803 37509
22729 1803
59931 22729
86437 59931
75596 86437
97533 75596
84264 97533
79370 84264
73290 79370
17059 73290
60073 17059
604 60073
89686 604
45405 89686
1176 45405
25995 ...

output:

51189 47838 98765 35392 10953 24097 74641 86378 63142 64069 12491 63565 15883 41516 29984 81204 96124 24446 7825 57155 44605 38765 8178 83778 12111 80741 8868 38750 62058 9034 10292 55306 29953 74995 631 8781 42499 42162 60664 33045 90314 4539 70754 8531 74033 30489 4047 69102 3482 44685 54859 52236...

result:

ok correct

Test #61:

score: 0
Accepted
time: 88ms
memory: 18036kb

input:

100000 400000
35357 73932
35357 71898
53297 35357
20900 39284
20900 36611
53297 20900
24574 53297
3496 19078
3496 63896
60776 3496
51617 31031
51617 73962
60776 51617
24574 60776
41273 24574
2824 85006
2824 22935
88300 2824
21588 95516
21588 81144
88300 21588
1650 88300
68562 25267
68562 31658
62356...

output:

62518 45245 62523 45242 26066 45241 62530 45238 62531 45234 26065 45197 26064 45191 62534 45185 62536 45170 26062 45164 26060 45146 26051 45143 73219 45137 26050 45133 62549 67581 26048 45120 62556 45119 26045 45114 62564 45100 62565 45099 26043 45096 26039 45089 26030 45083 62582 45081 62583 45046 ...

result:

ok correct

Test #62:

score: 0
Accepted
time: 102ms
memory: 22204kb

input:

100000 400000
49749 56050
49749 40208
54907 49749
38195 98216
38195 14892
54907 38195
56213 54907
53116 48113
53116 80410
17137 53116
23663 52076
23663 81699
17137 23663
56213 17137
26079 56213
91162 31575
91162 87334
39593 91162
1938 59342
1938 19586
39593 1938
77110 39593
53644 54722
53644 51522
7...

output:

56161 44971 7628 44961 61213 44960 34331 44959 64120 44950 69214 44940 3621 44939 15524 44926 33060 44919 44985 44906 79185 44899 51845 44893 1092 44880 75372 44878 81319 67249 49149 44861 91382 44859 14464 44856 66598 44853 53774 44841 60636 44806 21308 44793 24991 44782 50593 44766 84728 44751 554...

result:

ok correct

Test #63:

score: 0
Accepted
time: 123ms
memory: 21444kb

input:

100000 400000
9655 96550
75626 9655
54376 75626
11841 54376
73169 11841
41885 73169
84310 41885
12127 84310
19301 12127
70458 38257
5041 70458
84680 5041
50387 84680
73867 50387
11702 73867
89735 11702
29414 89735
75189 29414
41008 75189
39369 41008
43391 39369
6443 43391
4723 6443
24708 4723
48499 ...

output:

38257 22904 70458 22898 5041 22889 84680 22887 50387 22886 73867 22882 11702 22877 89735 22870 29414 22864 75189 22862 41008 6260 39369 22858 43391 22849 6443 23012 4723 23086 24708 23081 48499 23079 58708 23066 90323 23059 40282 23058 90401 23053 63104 23047 87927 22860 29496 23247 4641 23237 82203...

result:

ok correct

Test #64:

score: 0
Accepted
time: 106ms
memory: 21464kb

input:

100000 400000
85640 47421
88305 85640
5714 88305
12158 5714
21045 12158
4595 21045
59201 4595
70325 59201
12459 70325
75946 12459
59593 75946
73653 59593
36224 73653
37034 36224
11349 37034
78127 11349
80935 78127
44355 80935
50188 44355
6163 50188
35432 6163
32717 35432
44709 32717
20567 44709
6362...

output:

83961 77513 37115 77512 6830 91485 20166 77507 22010 91489 65522 1249 34999 3104 73277 77502 44759 91492 4456 77500 50254 35749 58018 77494 51236 77493 3907 77491 99753 91497 7524 91902 61002 91889 56145 91891 93290 91894 96427 77116 8591 91895 28331 77115 2056 77499 2602 91515 26459 77484 64873 915...

result:

ok correct

Test #65:

score: 0
Accepted
time: 131ms
memory: 23000kb

input:

100000 400000
68192 59977
99869 68192
79880 99869
85798 79880
65433 85798
25657 65433
81982 25657
1785 81982
86793 1785
92930 86793
97721 92930
85396 97721
47062 85396
84379 47062
51598 84379
79308 51598
16011 79308
99639 16011
29146 99639
55098 29146
40431 55098
33646 40431
60840 33646
2163 60840
8...

output:

56018 14554 76072 42642 70976 24377 42693 3665 94200 9777 35394 38577 1509 32408 95319 7568 45951 17538 72212 31317 61530 38472 456 2720 50047 60256 63149 29748 90292 56901 59148 72348 25058 54445 43830 24436 59375 11885 70122 77140 24157 37972 78603 15456 66685 64040 18760 63832 88172 55317 90402 2...

result:

ok correct

Test #66:

score: 0
Accepted
time: 81ms
memory: 18296kb

input:

100000 400000
67858 63179
67858 60149
74375 67858
57708 13959
57708 45053
74375 57708
90549 74375
95708 88814
95708 47964
94504 95708
19427 84873
19427 5912
94504 19427
90549 94504
55452 90549
5889 92006
5889 26256
6130 5889
37782 41675
37782 80036
6130 37782
5068 6130
68617 81486
68617 39080
19381 ...

output:

44673 14999 22977 17471 22976 50853 22974 50859 22971 50819 22949 14993 22946 14992 22942 50889 22941 17485 22939 50892 22937 42311 5618 64284 23108 14974 23176 42306 23173 42304 23169 14967 23157 14966 23152 17490 23150 50779 23148 15015 23137 42381 23135 50741 23134 50745 22935 50747 22320 42307 2...

result:

ok correct

Test #67:

score: 0
Accepted
time: 98ms
memory: 22240kb

input:

100000 400000
38314 97507
38314 37025
91153 38314
8519 9825
8519 1911
91153 8519
35444 91153
97524 48140
97524 81881
2370 97524
6135 77571
6135 89643
2370 6135
35444 2370
40772 35444
21728 57143
21728 12712
80043 21728
95691 79282
80043 95691
93628 80043
3661 35183
72076 3661
7018 80806
7018 30247
7...

output:

53093 49166 92839 49168 42556 49175 17644 49181 6083 49190 71109 36106 61350 49197 78404 49201 4556 49209 75756 49210 27708 12292 21975 49162 41110 49217 9879 49225 29242 49237 97069 36040 84773 36034 84324 49250 44249 49253 39393 36015 84321 49262 68709 49263 51257 49213 56231 47874 12980 47875 384...

result:

ok correct

Test #68:

score: 0
Accepted
time: 104ms
memory: 22124kb

input:

100000 400000
67585 35704
28722 67585
10112 28722
88548 10112
54253 88548
73133 54253
42287 73133
13364 42287
98176 13364
13394 6776
48919 13394
90568 48919
89149 90568
89172 89149
49551 89172
11410 49551
65186 11410
80867 65186
36623 80867
94769 36623
20810 94769
81487 20810
324 81487
57414 324
347...

output:

6776 91097 13394 91131 48919 85804 90568 85793 89149 85791 89172 85769 49551 85765 11410 85763 65186 85762 80867 85745 36623 77042 94769 91098 20810 85512 81487 85507 324 85491 57414 91298 34734 85490 18030 85475 93824 85472 56085 91329 96075 91211 32774 85426 18750 85744 20004 85722 94295 85721 317...

result:

ok correct

Test #69:

score: -0
Runtime Error

input:

100000 400000
6549 88281
89934 6549
87980 89934
95330 87980
1402 95330
73144 1402
92562 73144
84778 92562
76427 84778
15252 76427
18967 15252
11354 18967
27410 11354
32717 27410
6426 32717
32969 6426
50931 32969
63720 50931
38918 63720
94868 38918
54886 94868
65899 54886
48760 65899
39800 48760
6935...

output:

Unauthorized output

result:


Subtask #11:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Subtask #12:

score: 16
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Subtask #13:

score: 21
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #8:

100%
Accepted

Subtask #14:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #9:

0%

Subtask #15:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

0%