QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#815184#9881. Diverge and Convergeucup-team1878#TL 1440ms4548kbC++237.3kb2024-12-15 06:51:302024-12-15 06:51:31

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3644kb

input:

4
1 2
2 3
3 4
1 2
2 4
2 3

output:

3 2 1
2 3 1

result:

ok Correct, N = 4

Test #2:

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

input:

2
1 2
2 1

output:

1
1

result:

ok Correct, N = 2

Test #3:

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

input:

7
1 2
1 3
2 4
2 5
3 6
3 7
1 5
1 6
1 7
5 2
6 3
7 4

output:

6 5 3 2 4 1
3 5 6 2 4 1

result:

ok Correct, N = 7

Test #4:

score: 0
Accepted
time: 468ms
memory: 4532kb

input:

1000
780 67
364 281
934 245
121 472
460 233
574 534
91 687
91 832
413 613
815 638
519 196
992 120
150 157
198 365
643 700
279 698
623 215
578 330
869 333
874 570
879 697
897 671
962 670
108 137
779 9
988 91
919 314
696 722
431 270
810 692
769 49
254 915
737 580
229 888
379 612
19 161
787 346
280 753...

output:

448 458 134 215 381 286 486 484 883 497 538 509 511 889 532 895 703 259 667 195 188 154 375 526 530 602 186 314 687 449 306 837 178 128 164 787 462 734 310 47 731 210 775 482 418 153 546 131 803 34 956 86 429 124 149 614 28 641 810 390 297 845 126 541 615 868 913 809 938 920 947 754 852 72 901 706 3...

result:

ok Correct, N = 1000

Test #5:

score: 0
Accepted
time: 924ms
memory: 4548kb

input:

1000
666 194
70 687
680 703
661 583
370 940
560 387
333 171
948 872
606 785
887 95
130 640
845 792
156 125
281 757
287 160
139 736
896 670
345 200
475 429
18 728
520 31
170 53
531 614
22 391
668 228
674 354
807 999
726 288
572 616
586 9
284 8
353 37
102 927
223 63
733 423
253 964
336 483
200 42
177 ...

output:

671 418 561 679 431 179 240 740 82 716 851 587 672 94 799 645 610 723 8 481 542 382 19 988 544 547 250 769 787 80 44 882 251 756 265 493 751 992 964 595 908 600 666 249 436 714 465 132 622 147 952 934 903 675 598 100 349 495 713 789 938 220 189 345 30 743 170 580 886 599 528 746 188 985 136 248 269 ...

result:

ok Correct, N = 1000

Test #6:

score: 0
Accepted
time: 460ms
memory: 4344kb

input:

1000
795 108
135 674
10 453
622 79
788 110
68 687
973 367
859 1
274 686
978 410
51 450
791 196
715 58
445 692
802 843
644 219
535 565
798 846
6 682
372 227
950 972
72 870
940 245
657 817
715 79
302 450
249 981
342 164
674 677
96 420
334 949
157 511
162 572
912 138
209 886
759 727
167 909
608 916
923...

output:

206 705 257 948 565 958 645 961 158 417 317 486 936 616 280 171 403 335 980 457 610 903 667 167 896 812 566 719 848 572 357 251 408 61 918 985 581 346 460 107 740 947 43 695 641 71 126 89 53 704 753 237 525 472 800 226 88 839 747 591 366 78 478 603 706 270 505 548 92 345 180 313 562 990 907 927 928 ...

result:

ok Correct, N = 1000

Test #7:

score: 0
Accepted
time: 203ms
memory: 4048kb

input:

692
424 608
333 156
80 434
325 278
253 574
201 409
282 68
191 365
586 361
240 162
86 321
609 33
222 610
58 37
501 552
420 595
422 447
251 203
176 257
521 221
324 398
133 350
602 352
307 373
348 253
578 471
591 327
132 326
142 314
262 377
682 508
282 152
32 333
230 500
311 562
587 309
364 370
405 493...

output:

237 116 422 593 567 557 204 432 370 411 232 624 526 90 566 556 424 49 508 533 429 448 188 558 643 283 205 472 79 599 438 332 568 559 72 403 630 497 139 501 143 295 359 634 179 684 339 274 668 646 169 590 686 209 621 12 17 105 582 660 115 623 35 534 197 381 511 482 86 539 321 293 151 270 235 218 224 ...

result:

ok Correct, N = 692

Test #8:

score: 0
Accepted
time: 120ms
memory: 4300kb

input:

582
389 387
379 380
415 416
463 464
325 323
265 267
183 184
201 199
1 3
51 52
217 218
89 91
263 265
189 190
241 243
398 397
1 2
319 321
469 470
473 471
389 390
233 234
296 295
437 435
565 567
305 303
394 393
15 17
45 43
442 441
7 5
81 82
549 547
495 497
13 11
449 450
23 21
308 307
379 377
160 159
50...

output:

251 17 450 499 347 475 573 374 119 89 389 109 100 408 65 75 220 91 491 148 326 329 341 554 10 303 330 314 47 288 217 122 393 427 358 479 335 503 478 149 419 83 381 55 32 376 276 337 245 316 434 482 219 108 557 164 289 282 411 159 468 373 383 424 579 375 295 117 362 428 264 283 380 391 201 322 343 19...

result:

ok Correct, N = 582

Test #9:

score: 0
Accepted
time: 28ms
memory: 4132kb

input:

276
73 72
84 85
88 89
225 224
40 39
7 8
93 92
5 4
90 91
166 167
208 207
169 170
173 174
186 187
78 79
108 109
49 48
245 246
142 143
149 150
203 202
234 235
103 104
23 22
148 149
139 138
230 229
274 275
32 31
228 227
152 153
166 165
160 159
267 268
276 275
120 119
188 187
110 111
49 50
270 269
253 25...

output:

35 28 161 77 257 160 40 232 34 248 94 130 245 115 255 208 270 100 111 79 178 262 41 183 156 239 149 44 240 221 18 109 69 65 53 86 271 113 133 131 92 22 269 261 135 190 27 74 30 181 206 4 76 252 215 146 61 173 233 126 267 57 274 247 123 224 203 144 11 211 153 72 191 21 182 110 176 268 85 229 188 218 ...

result:

ok Correct, N = 276

Test #10:

score: 0
Accepted
time: 137ms
memory: 4416kb

input:

612
25 26
245 246
414 415
91 92
386 385
65 64
606 607
396 397
19 20
210 211
280 281
230 231
300 301
339 338
230 229
232 231
148 147
169 170
327 326
274 275
545 546
153 152
488 489
54 55
510 509
244 243
603 602
264 263
111 110
459 458
433 434
288 287
339 340
315 316
576 577
257 258
263 262
461 460
48...

output:

143 220 467 217 201 7 498 248 328 27 135 278 103 384 60 204 601 393 346 534 195 509 427 539 276 524 607 510 123 577 265 117 211 479 121 35 326 332 91 283 519 457 316 169 339 83 148 502 470 175 178 262 380 41 127 412 190 77 324 239 99 256 63 47 238 352 21 453 57 309 54 96 165 351 101 446 465 300 69 3...

result:

ok Correct, N = 612

Test #11:

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

input:

446
208 207
90 91
53 54
25 24
236 235
264 263
420 419
47 48
371 372
77 78
202 201
393 394
37 36
393 392
407 406
89 88
415 416
285 284
362 361
267 266
131 132
251 252
149 150
133 132
283 284
261 260
250 249
169 168
151 152
247 248
111 112
421 420
40 41
47 46
361 360
436 435
81 82
60 61
439 438
6 5
17...

output:

262 330 236 64 153 337 273 39 81 409 36 89 395 279 363 440 393 179 224 411 148 404 300 104 336 32 7 328 177 280 17 121 364 87 429 59 132 315 165 15 389 434 184 171 111 352 320 109 199 376 158 271 12 14 370 244 56 243 190 97 266 306 131 99 118 312 261 294 298 318 308 176 206 269 9 229 368 119 355 248...

result:

ok Correct, N = 446

Test #12:

score: 0
Accepted
time: 344ms
memory: 4192kb

input:

1000
765 382
808 404
236 473
418 837
34 68
869 434
326 652
362 725
96 192
490 981
694 347
487 975
129 259
187 375
247 494
290 145
310 155
58 116
394 788
143 71
380 190
172 86
683 341
234 117
435 217
691 345
252 505
141 282
68 137
990 495
566 283
692 346
398 796
782 391
671 335
258 517
369 184
241 48...

output:

683 115 818 235 143 210 977 462 754 677 302 464 184 54 553 415 939 388 219 10 132 366 633 627 279 113 542 765 163 98 449 978 267 307 835 244 91 406 177 457 141 843 88 610 360 41 645 543 956 90 486 401 19 923 797 30 195 915 357 105 292 620 315 812 175 579 456 731 635 826 600 898 532 460 309 476 496 9...

result:

ok Correct, N = 1000

Test #13:

score: 0
Accepted
time: 346ms
memory: 4192kb

input:

1000
454 909
325 651
334 167
333 166
266 533
384 768
612 306
936 468
517 258
371 742
419 209
324 649
895 447
198 397
240 481
369 184
96 193
367 734
275 551
348 696
229 459
192 384
829 414
342 685
147 73
421 210
64 32
207 415
252 126
153 306
980 490
435 870
398 797
24 12
754 377
77 38
925 462
201 403...

output:

548 310 69 837 902 929 83 429 292 91 48 994 193 112 448 350 889 894 878 406 436 729 802 914 937 589 479 12 688 911 107 743 247 253 198 745 884 163 264 420 567 624 521 705 484 37 502 108 870 501 885 780 828 919 403 115 932 400 494 557 274 997 725 764 559 632 695 248 2 51 399 338 497 192 888 544 711 1...

result:

ok Correct, N = 1000

Test #14:

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

input:

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

output:

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

result:

ok Correct, N = 15

Test #15:

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

input:

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

output:

3 2 4 6 7 5 1
4 2 5 1 6 3 7

result:

ok Correct, N = 8

Test #16:

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

input:

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

output:

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

result:

ok Correct, N = 17

Test #17:

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

input:

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

output:

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

result:

ok Correct, N = 9

Test #18:

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

input:

4
3 1
4 1
2 4
4 2
1 4
3 2

output:

1 3 2
3 1 2

result:

ok Correct, N = 4

Test #19:

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

input:

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

output:

6 1 4 5 3 7 2
5 1 2 3 7 4 6

result:

ok Correct, N = 8

Test #20:

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

input:

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

output:

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

result:

ok Correct, N = 16

Test #21:

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

input:

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

output:

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

result:

ok Correct, N = 14

Test #22:

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

input:

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

output:

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

result:

ok Correct, N = 16

Test #23:

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

input:

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

output:

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

result:

ok Correct, N = 9

Test #24:

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

input:

2
1 2
1 2

output:

1
1

result:

ok Correct, N = 2

Test #25:

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

input:

84
23 4
43 14
77 84
66 37
67 76
32 5
5 54
35 63
72 73
78 55
52 20
80 53
54 44
59 30
39 66
70 21
5 40
64 24
46 35
41 8
31 71
79 6
12 47
68 36
17 82
37 26
61 56
68 50
57 20
1 79
74 48
43 31
3 76
46 60
71 16
28 30
75 18
70 66
17 76
20 22
59 39
41 27
46 81
2 32
45 38
4 32
12 78
51 48
53 49
33 36
40 53
6...

output:

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

result:

ok Correct, N = 84

Test #26:

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

input:

66
41 35
42 55
65 3
50 11
61 33
5 66
17 54
19 36
1 45
19 16
28 15
45 51
27 54
65 49
62 40
19 10
11 30
66 52
1 24
2 61
13 26
44 27
20 28
13 56
48 33
29 50
41 4
34 29
60 7
45 27
34 6
57 25
46 2
40 9
59 57
60 6
37 64
6 23
11 53
24 53
64 43
10 24
16 35
61 63
32 6
40 65
49 58
40 41
12 11
39 38
43 22
1 31...

output:

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

result:

ok Correct, N = 66

Test #27:

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

input:

94
74 55
25 94
36 70
23 42
40 89
72 78
80 1
34 11
85 72
33 43
71 74
94 87
63 77
45 37
54 67
11 51
47 42
19 79
60 21
80 11
65 76
5 84
41 25
26 62
57 1
88 23
85 53
34 84
56 73
8 37
18 57
66 58
77 67
31 3
92 43
82 23
50 17
51 38
81 54
9 28
93 2
92 76
45 23
83 30
39 75
52 15
48 21
26 14
49 56
29 53
69 4...

output:

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

result:

ok Correct, N = 94

Test #28:

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

input:

4
4 2
2 1
3 4
3 4
1 2
3 1

output:

3 1 2
1 3 2

result:

ok Correct, N = 4

Test #29:

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

input:

75
61 33
57 64
46 18
22 59
35 58
62 73
51 67
27 23
56 34
59 66
8 74
48 19
33 19
42 72
32 16
6 69
25 9
27 10
37 64
32 60
46 20
61 51
51 21
31 55
45 6
33 75
11 5
73 75
13 25
2 3
18 29
58 24
11 67
60 39
34 65
42 7
50 56
38 23
65 31
8 4
70 52
71 44
67 43
35 28
29 71
68 25
13 20
21 26
57 35
24 40
16 19
8...

output:

66 54 68 46 41 30 57 10 14 65 37 9 4 56 36 64 35 58 73 38 67 50 8 24 39 55 18 17 61 27 29 21 62 48 42 32 19 69 11 12 5 74 40 72 52 34 20 33 43 7 6 16 15 25 51 63 53 47 13 28 2 26 22 23 1 59 49 70 45 44 31 3 71 60
30 63 55 69 35 40 12 22 42 29 39 8 36 4 34 11 6 38 2 19 18 46 45 9 25 7 57 10 56 27 43 ...

result:

ok Correct, N = 75

Test #30:

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

input:

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

output:

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

result:

ok Correct, N = 16

Test #31:

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

input:

73
66 62
56 14
25 38
52 5
45 44
63 33
28 59
34 27
58 7
62 2
57 31
30 66
72 47
20 34
44 3
12 71
61 19
19 44
55 67
40 13
70 33
1 68
23 68
40 12
10 29
62 39
22 2
65 21
48 6
17 19
45 52
36 31
72 1
46 41
53 42
32 53
1 7
72 60
25 4
51 32
10 28
24 48
28 16
8 59
68 71
1 54
42 9
23 11
71 61
54 18
17 35
37 73...

output:

9 37 68 55 51 20 50 71 52 29 24 34 46 38 3 61 2 62 53 13 44 60 47 43 25 19 42 57 28 39 58 7 41 48 72 35 12 21 36 23 16 30 40 67 63 27 4 26 33 1 15 11 64 6 10 70 31 59 65 69 32 66 5 18 54 14 8 17 56 49 45 22
64 51 42 71 55 50 34 3 45 56 26 67 6 24 15 47 35 16 44 22 19 1 54 32 7 12 36 33 53 72 41 30 6...

result:

ok Correct, N = 73

Test #32:

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

input:

6
3 4
5 3
6 5
3 2
3 1
2 1
2 4
5 1
3 4
2 6

output:

1 4 3 2 5
4 2 5 3 1

result:

ok Correct, N = 6

Test #33:

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

input:

42
17 27
26 1
16 37
39 18
5 25
36 19
42 31
10 4
14 9
29 18
40 31
11 12
40 35
36 41
11 2
33 7
13 14
42 23
8 13
6 4
42 38
34 23
21 15
41 28
1 30
16 26
6 15
29 5
3 35
11 1
15 13
31 26
24 15
32 22
13 29
35 20
4 36
12 33
17 29
32 38
34 39
24 40
7 36
20 27
35 22
4 21
1 14
36 13
40 16
8 13
22 5
7 9
24 20
3...

output:

25 15 29 3 16 34 38 40 12 1 36 26 39 13 21 5 28 8 24 9 17 6 11 19 23 33 37 14 30 20 31 35 10 27 4 41 22 7 18 32 2
13 16 26 36 18 28 31 19 30 3 12 8 14 22 33 29 10 25 4 11 6 32 1 9 5 27 2 39 41 34 15 7 37 24 35 40 23 17 38 21 20

result:

ok Correct, N = 42

Test #34:

score: 0
Accepted
time: 1440ms
memory: 4288kb

input:

882
126 312
346 327
323 657
873 39
203 188
747 657
594 754
87 324
652 331
196 873
500 47
367 346
725 860
790 45
664 534
83 231
719 149
821 538
489 661
17 563
852 856
612 349
60 338
703 568
765 637
434 432
107 37
764 788
180 581
865 500
753 771
702 846
738 215
680 129
576 319
420 741
327 815
497 474
...

output:

703 628 218 307 55 326 329 688 858 811 121 711 716 116 106 546 130 600 291 641 339 277 54 124 527 154 117 776 512 796 190 236 422 845 202 191 276 346 61 27 217 840 667 519 75 821 87 409 802 350 56 366 173 231 384 854 563 135 101 799 597 227 503 254 359 296 71 805 740 325 493 192 127 59 230 194 287 2...

result:

ok Correct, N = 882

Test #35:

score: -100
Time Limit Exceeded

input:

828
166 272
327 91
386 455
624 483
586 620
747 292
550 619
305 822
62 596
787 705
507 477
130 61
499 195
654 181
773 331
110 731
651 369
459 656
640 234
28 667
796 452
212 452
445 195
512 669
105 276
244 563
744 637
33 418
366 708
144 253
351 571
427 558
304 625
59 295
652 715
87 139
583 146
273 145...

output:


result: