QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#848162#1458. Binary Search AlgorithmHuangHanShengAC ✓162ms66632kbC++171.0kb2025-01-08 16:36:082025-01-08 16:36:09

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
add 1
1
add 3
3 1
delete 1

add 2
3 2
delete 3
2
delete 2


output:

1 1 
1
2 1 3 
3
0 
3
2 3 2 
3
1 2 
2
0 
-1

result:

ok n=3, OK

Test #2:

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

input:

10
add 9
9
add 4
9 4
add 6
9 6
delete 9
4 6
add 7
7 4
delete 4
6
add 5
7 5
add 8
7 8 6
add 10
7 10 5
delete 8
6
add 3
3 7 6
add 2
3 2
delete 6

delete 10
5
delete 7
5
add 1
3 1 5
delete 1
5
delete 3
5 2
delete 5
2
delete 2


output:

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

result:

ok n=10, OK

Test #3:

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

input:

100
add 81
81
add 96
81 96
add 94
81 94
add 32
81 32 96
add 35
81 94 35
add 59
81 32 59
add 50
81 50 94
add 57
81 57 32 96
add 39
39 81 50
add 55
39 55
add 23
39 81 50 23
add 40
39 40 55
add 5
39 81 57 5
add 2
39 40 2
delete 55

add 12
39 81 50 12 94
delete 40
2
add 51
39 51 2
add 65
39 81 57 65 32 ...

output:

1 81 
81
2 81 96 
81
2 81 94 
81
3 81 96 32 
81
3 81 94 35 
81
3 81 32 59 
81
3 81 94 50 
81
4 81 32 96 57 
81
3 81 50 39 
39
2 39 55 
39
4 39 81 50 23 
39
3 39 55 40 
39
4 39 81 57 5 
39
3 39 40 2 
39
0 
39
5 39 81 50 94 12 
39
1 2 
39
3 39 2 51 
39
6 39 81 57 32 96 65 
39
0 
39
3 39 51 69 
39
4 69...

result:

ok n=100, OK

Test #4:

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

input:

100
add 71
71
add 75
71 75
add 43
43 71
add 69
43 69
add 55
43 71 55
add 89
43 89 69
add 31
43 71 31 75
add 52
43 89 52
add 24
24 43 71 55
add 6
24 6
add 9
24 43 71 55 9
add 62
24 6 62
add 19
24 43 89 69 19
add 35
24 35 6
add 38
24 43 71 31 38
add 39
39 24 35
add 63
39 63
add 68
39 68 24 35
add 98
3...

output:

1 71 
71
2 71 75 
71
2 71 43 
43
2 43 69 
43
3 43 71 55 
43
3 43 69 89 
43
4 43 71 75 31 
43
3 43 89 52 
43
4 43 71 55 24 
24
2 24 6 
24
5 24 43 71 55 9 
24
3 24 6 62 
24
5 24 43 89 69 19 
24
3 24 6 35 
24
5 24 43 71 31 38 
24
3 24 35 39 
39
2 39 63 
39
4 39 24 35 68 
39
3 39 63 98 
39
3 39 68 44 
3...

result:

ok n=100, OK

Test #5:

score: 0
Accepted
time: 13ms
memory: 9232kb

input:

1000
add 93
93
add 917
93 917
add 921
93 921
add 70
93 917 70
add 949
93 949 921
add 777
93 777 917
add 237
93 949 237
add 581
581 93 777
add 461
581 461
add 319
581 93 777 319
add 42
581 42 461
add 690
581 93 690 949 921
add 631
581 631 42
add 135
581 93 777 917 135
add 424
581 631 424
add 647
581 ...

output:

1 93 
93
2 93 917 
93
2 93 921 
93
3 93 917 70 
93
3 93 921 949 
93
3 93 917 777 
93
3 93 949 237 
93
3 93 777 581 
581
2 581 461 
581
4 581 93 777 319 
581
3 581 461 42 
581
5 581 93 949 921 690 
581
3 581 42 631 
581
5 581 93 777 917 135 
581
3 581 631 424 
581
4 581 93 690 647 
581
4 581 631 42 1...

result:

ok n=1000, OK

Test #6:

score: 0
Accepted
time: 13ms
memory: 8044kb

input:

1000
add 589
589
add 844
589 844
add 341
589 341
add 362
589 844 362
add 955
955 589 341
add 565
955 565
add 467
955 589 341 467
add 664
955 565 664
add 167
167 955 589 844
add 879
167 879
add 934
167 934 955 589 844
add 757
167 757 879
add 941
167 934 941
add 56
167 757 56
add 337
167 934 337 955 5...

output:

1 589 
589
2 589 844 
589
2 589 341 
589
3 589 844 362 
589
3 589 341 955 
955
2 955 565 
955
4 955 589 341 467 
955
3 955 565 664 
955
4 955 589 844 167 
167
2 167 879 
167
5 167 955 589 844 934 
167
3 167 879 757 
167
3 167 934 941 
167
3 167 757 56 
167
6 167 934 955 589 844 337 
167
4 167 757 87...

result:

ok n=1000, OK

Test #7:

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

input:

8000
add 2497
2497
add 827
827 2497
add 4801
827 4801
add 2709
827 2709 2497
add 4516
827 4801 4516
add 656
827 656 2709
add 4773
4773 827 4801
add 1444
4773 1444
add 2338
4773 827 4801 2338
add 1254
4773 1444 1254
add 5749
4773 827 656 5749
add 3926
4773 3926 1444
add 7537
4773 827 7537 4801 4516
a...

output:

1 2497 
2497
2 2497 827 
827
2 827 4801 
827
3 827 2497 2709 
827
3 827 4801 4516 
827
3 827 2709 656 
827
3 827 4801 4773 
4773
2 4773 1444 
4773
4 4773 827 4801 2338 
4773
3 4773 1444 1254 
4773
4 4773 827 656 5749 
4773
3 4773 1444 3926 
4773
5 4773 827 4801 4516 7537 
4773
3 4773 3926 6800 
4773...

result:

ok n=8000, OK

Test #8:

score: 0
Accepted
time: 162ms
memory: 51584kb

input:

8000
add 1866
1866
add 5228
5228 1866
add 4496
5228 4496
add 2574
5228 1866 2574
add 1492
5228 4496 1492
add 5427
5228 1866 5427
add 3355
3355 5228 4496
add 5495
3355 5495
add 6421
3355 5228 4496 6421
add 7543
3355 7543 5495
add 4400
3355 4400 5228 1866 2574
add 4311
3355 7543 4311
add 7572
7572 335...

output:

1 1866 
1866
2 1866 5228 
5228
2 5228 4496 
5228
3 5228 1866 2574 
5228
3 5228 4496 1492 
5228
3 5228 1866 5427 
5228
3 5228 4496 3355 
3355
2 3355 5495 
3355
4 3355 5228 4496 6421 
3355
3 3355 5495 7543 
3355
5 3355 5228 1866 2574 4400 
3355
3 3355 7543 4311 
3355
3 3355 4400 7572 
7572
2 7572 3077...

result:

ok n=8000, OK

Test #9:

score: 0
Accepted
time: 23ms
memory: 9288kb

input:

1000
add 964
964
add 650
964 650
add 967
964 967
add 129
964 650 129
add 345
964 967 345
add 454
964 650 454
add 614
964 967 614
add 11
964 650 129 11
add 963
964 967 345 963
add 357
964 650 454 357
add 300
964 967 614 300
add 785
964 650 129 785
add 700
964 967 345 700
add 442
964 650 454 442
add 1...

output:

1 964 
964
2 964 650 
964
2 964 967 
964
3 964 650 129 
964
3 964 967 345 
964
3 964 650 454 
964
3 964 967 614 
964
4 964 650 129 11 
964
4 964 967 345 963 
964
4 964 650 454 357 
964
4 964 967 614 300 
964
4 964 650 129 785 
964
4 964 967 345 700 
964
4 964 650 454 442 
964
4 964 967 614 14 
964
5...

result:

ok n=1000, OK

Test #10:

score: 0
Accepted
time: 23ms
memory: 10984kb

input:

1000
add 651
651
add 792
792 651
add 816
792 816
add 325
792 651 325
add 876
792 816 876
add 408
792 651 408
add 289
792 816 289
add 746
792 746 651 325
add 492
792 816 876 492
add 2
792 746 2
add 462
792 462 816 289
add 98
792 746 651 98 325
add 68
792 462 68
add 69
792 746 69 2
add 834
792 462 816...

output:

1 651 
651
2 651 792 
792
2 792 816 
792
3 792 651 325 
792
3 792 816 876 
792
3 792 651 408 
792
3 792 816 289 
792
4 792 651 325 746 
792
4 792 816 876 492 
792
3 792 746 2 
792
4 792 816 289 462 
792
5 792 746 651 325 98 
792
3 792 462 68 
792
4 792 746 2 69 
792
5 792 462 816 289 834 
792
5 792 ...

result:

ok n=1000, OK

Test #11:

score: 0
Accepted
time: 148ms
memory: 66632kb

input:

8000
add 4964
4964
add 650
4964 650
add 6871
4964 6871
add 129
4964 650 129
add 3768
4964 6871 3768
add 1551
4964 650 1551
add 6223
4964 6871 6223
add 3875
4964 650 129 3875
add 6536
4964 6871 3768 6536
add 6438
4964 650 1551 6438
add 5015
4964 6871 6223 5015
add 2528
4964 650 129 2528
add 1952
4964...

output:

1 4964 
4964
2 4964 650 
4964
2 4964 6871 
4964
3 4964 650 129 
4964
3 4964 6871 3768 
4964
3 4964 650 1551 
4964
3 4964 6871 6223 
4964
4 4964 650 129 3875 
4964
4 4964 6871 3768 6536 
4964
4 4964 650 1551 6438 
4964
4 4964 6871 6223 5015 
4964
4 4964 650 129 2528 
4964
4 4964 6871 3768 1952 
4964
...

result:

ok n=8000, OK

Test #12:

score: 0
Accepted
time: 142ms
memory: 66288kb

input:

8000
add 3562
3562
add 2628
3562 2628
add 6508
6508 3562
add 1830
6508 1830
add 6995
6508 6995 3562
add 2741
6508 2741 1830
add 3523
6508 6995 3523
add 4497
6508 4497 2741
add 1175
6508 6995 3562 1175
add 5626
6508 4497 5626
add 2252
6508 6995 3523 2252
add 2606
6508 4497 2741 2606
add 6190
6508 699...

output:

1 3562 
3562
2 3562 2628 
3562
2 3562 6508 
6508
2 6508 1830 
6508
3 6508 3562 6995 
6508
3 6508 1830 2741 
6508
3 6508 6995 3523 
6508
3 6508 2741 4497 
6508
4 6508 6995 3562 1175 
6508
3 6508 4497 5626 
6508
4 6508 6995 3523 2252 
6508
4 6508 4497 2741 2606 
6508
5 6508 6995 3562 2628 6190 
6508
4...

result:

ok n=8000, OK

Test #13:

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

input:

10
add 3
3
add 7
3 7
add 10
3 10
add 1
3 7 1
add 9
3 10 9
add 5
3 7 5
add 4
3 10 4
add 8
3 7 1 8
add 6
3 10 9 6
add 2
3 7 5 2
delete 3
7 10 1 4
delete 7
10 9 5
delete 10
1 9 8 6
delete 1
9 5 4
delete 9
5 8 2
delete 5
4 8 6
delete 4
8 6
delete 8
6 2
delete 6
2
delete 2


output:

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

result:

ok n=10, OK

Test #14:

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

input:

10
add 9
9
add 5
9 5
add 2
9 2
add 7
7 9 5
add 4
7 4
add 3
3 7 9 5
add 1
3 1
add 6
3 7 9 5 6
add 10
3 10 1
add 8
3 7 4 8
delete 9
5 2
delete 3
7 10 5 6
delete 7
10 1 4
delete 5
6 2
delete 10
1 6
delete 1
4 6
delete 6
2
delete 4
8 2
delete 2

delete 8


output:

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

result:

ok n=10, OK

Test #15:

score: 0
Accepted
time: 14ms
memory: 9636kb

input:

1000
add 964
964
add 650
964 650
add 967
964 967
add 129
964 650 129
add 345
964 967 345
add 454
964 650 454
add 614
964 967 614
add 11
964 650 129 11
add 963
964 967 345 963
add 357
964 650 454 357
add 300
964 967 614 300
add 785
964 650 129 785
add 700
964 967 345 700
add 442
964 650 454 442
add 1...

output:

1 964 
964
2 964 650 
964
2 964 967 
964
3 964 650 129 
964
3 964 967 345 
964
3 964 650 454 
964
3 964 967 614 
964
4 964 650 129 11 
964
4 964 967 345 963 
964
4 964 650 454 357 
964
4 964 967 614 300 
964
4 964 650 129 785 
964
4 964 967 345 700 
964
4 964 650 454 442 
964
4 964 967 614 14 
964
5...

result:

ok n=1000, OK

Test #16:

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

input:

1000
add 871
871
add 449
449 871
add 644
644 449
add 97
97 644
add 853
853 97
add 496
496 853
add 418
418 496
add 207
207 418
add 401
401 207
add 519
519 401
add 276
276 519
add 576
576 276
add 74
74 576
add 194
194 74
add 719
719 194
add 252
252 719
add 718
718 252
add 137
137 718
add 292
292 137
a...

output:

1 871 
871
2 871 449 
449
2 449 644 
644
2 644 97 
97
2 97 853 
853
2 853 496 
496
2 496 418 
418
2 418 207 
207
2 207 401 
401
2 401 519 
519
2 519 276 
276
2 276 576 
576
2 576 74 
74
2 74 194 
194
2 194 719 
719
2 719 252 
252
2 252 718 
718
2 718 137 
137
2 137 292 
292
2 292 902 
902
2 902 530 ...

result:

ok n=1000, OK

Test #17:

score: 0
Accepted
time: 22ms
memory: 10244kb

input:

1000
add 35
35
add 747
35 747
add 391
35 391
add 770
35 770 747
add 707
35 391 707
add 344
35 770 344
add 881
35 391 881
add 753
35 770 747 753
add 266
35 391 707 266
add 126
126 35 770 344
add 11
11 126
add 705
11 705
add 672
11 126 672
add 107
11 107 705
add 439
11 126 35 770 439 344
add 958
11 95...

output:

1 35 
35
2 35 747 
35
2 35 391 
35
3 35 747 770 
35
3 35 391 707 
35
3 35 770 344 
35
3 35 391 881 
35
4 35 770 747 753 
35
4 35 391 707 266 
35
4 35 770 344 126 
126
2 126 11 
11
2 11 705 
11
3 11 126 672 
11
3 11 705 107 
11
6 11 126 35 770 344 439 
11
3 11 107 958 
11
4 11 126 672 432 
11
3 11 95...

result:

ok n=1000, OK

Test #18:

score: 0
Accepted
time: 17ms
memory: 11048kb

input:

1000
add 914
914
add 326
326 914
add 650
650 326
add 629
650 629
add 626
650 626 326
add 416
650 629 416
add 785
650 785 626
add 837
650 837 629
add 300
650 300 785
add 700
650 700 837
add 164
650 300 164
add 786
650 700 786
add 304
650 300 785 304
add 450
650 700 450 837
add 72
650 300 72 164
add 3...

output:

1 914 
914
2 914 326 
326
2 326 650 
650
2 650 629 
650
3 650 326 626 
650
3 650 629 416 
650
3 650 626 785 
650
3 650 629 837 
650
3 650 785 300 
650
3 650 837 700 
650
3 650 300 164 
650
3 650 700 786 
650
4 650 300 785 304 
650
4 650 700 837 450 
650
4 650 300 164 72 
650
4 650 700 786 357 
650
5...

result:

ok n=1000, OK

Test #19:

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

input:

1000
add 129
129
add 786
129 786
add 614
129 614
add 967
967 129 786
add 454
967 454
add 34
967 129 34 786
add 700
967 454 700
add 300
967 129 614 300
add 488
967 454 488
add 963
967 129 963 34
add 79
967 454 700 79
add 743
967 129 614 743
add 11
967 454 11 488
add 384
967 129 963 384
add 980
967 45...

output:

1 129 
129
2 129 786 
129
2 129 614 
129
3 129 786 967 
967
2 967 454 
967
4 967 129 786 34 
967
3 967 454 700 
967
4 967 129 614 300 
967
3 967 454 488 
967
4 967 129 34 963 
967
4 967 454 700 79 
967
4 967 129 614 743 
967
4 967 454 488 11 
967
4 967 129 963 384 
967
4 967 454 700 980 
967
5 967 1...

result:

ok n=1000, OK

Test #20:

score: 0
Accepted
time: 111ms
memory: 65520kb

input:

8000
add 4964
4964
add 650
4964 650
add 6871
4964 6871
add 129
4964 650 129
add 3768
4964 6871 3768
add 1551
4964 650 1551
add 6223
4964 6871 6223
add 3875
4964 650 129 3875
add 6536
4964 6871 3768 6536
add 6438
4964 650 1551 6438
add 5015
4964 6871 6223 5015
add 2528
4964 650 129 2528
add 1952
4964...

output:

1 4964 
4964
2 4964 650 
4964
2 4964 6871 
4964
3 4964 650 129 
4964
3 4964 6871 3768 
4964
3 4964 650 1551 
4964
3 4964 6871 6223 
4964
4 4964 650 129 3875 
4964
4 4964 6871 3768 6536 
4964
4 4964 650 1551 6438 
4964
4 4964 6871 6223 5015 
4964
4 4964 650 129 2528 
4964
4 4964 6871 3768 1952 
4964
...

result:

ok n=8000, OK

Test #21:

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

input:

8000
add 3493
3493
add 5110
5110 3493
add 533
533 5110
add 1700
1700 533
add 4277
4277 1700
add 2368
2368 4277
add 4495
4495 2368
add 4305
4305 4495
add 6965
6965 4305
add 2503
2503 6965
add 4339
4339 2503
add 5195
5195 4339
add 2364
2364 5195
add 3802
3802 2364
add 1752
1752 3802
add 6812
6812 1752...

output:

1 3493 
3493
2 3493 5110 
5110
2 5110 533 
533
2 533 1700 
1700
2 1700 4277 
4277
2 4277 2368 
2368
2 2368 4495 
4495
2 4495 4305 
4305
2 4305 6965 
6965
2 6965 2503 
2503
2 2503 4339 
4339
2 4339 5195 
5195
2 5195 2364 
2364
2 2364 3802 
3802
2 3802 1752 
1752
2 1752 6812 
6812
2 6812 2956 
2956
2 ...

result:

ok n=8000, OK

Test #22:

score: 0
Accepted
time: 126ms
memory: 65484kb

input:

8000
add 612
612
add 2743
612 2743
add 7916
612 7916
add 1433
1433 612 2743
add 2140
1433 2140
add 840
1433 612 2743 840
add 4289
1433 4289 2140
add 3912
1433 612 3912 7916
add 6323
1433 4289 6323
add 3859
1433 612 3859 2743
add 4368
1433 4289 2140 4368
add 6046
1433 612 6046 3912
add 1405
1433 4289...

output:

1 612 
612
2 612 2743 
612
2 612 7916 
612
3 612 2743 1433 
1433
2 1433 2140 
1433
4 1433 612 2743 840 
1433
3 1433 2140 4289 
1433
4 1433 612 7916 3912 
1433
3 1433 4289 6323 
1433
4 1433 612 2743 3859 
1433
4 1433 4289 2140 4368 
1433
4 1433 612 3912 6046 
1433
4 1433 4289 6323 1405 
1433
4 1433 6...

result:

ok n=8000, OK

Test #23:

score: 0
Accepted
time: 160ms
memory: 65936kb

input:

8000
add 3393
3393
add 5029
5029 3393
add 650
650 5029
add 3599
650 3599
add 5102
650 5102 5029
add 5122
650 5122 3599
add 6641
650 5102 6641
add 475
650 5122 475
add 1323
650 5102 5029 1323
add 1821
650 1821 5122 3599
add 3447
650 5102 6641 3447
add 578
650 1821 578
add 7293
650 5102 5029 7293 3393...

output:

1 3393 
3393
2 3393 5029 
5029
2 5029 650 
650
2 650 3599 
650
3 650 5029 5102 
650
3 650 3599 5122 
650
3 650 5102 6641 
650
3 650 5122 475 
650
4 650 5102 5029 1323 
650
4 650 5122 3599 1821 
650
4 650 5102 6641 3447 
650
3 650 1821 578 
650
5 650 5102 5029 3393 7293 
650
5 650 1821 5122 3599 5600...

result:

ok n=8000, OK

Test #24:

score: 0
Accepted
time: 156ms
memory: 65636kb

input:

8000
add 3768
3768
add 878
3768 878
add 5029
3768 5029
add 1821
3768 1821 878
add 5001
3768 5029 5001
add 1608
3768 1821 1608
add 2691
3768 5029 2691
add 7293
3768 1821 878 7293
add 7275
3768 5029 5001 7275
add 6223
3768 6223 1821 1608
add 227
3768 5029 2691 227
add 3809
3768 6223 3809
add 4675
3768...

output:

1 3768 
3768
2 3768 878 
3768
2 3768 5029 
3768
3 3768 878 1821 
3768
3 3768 5029 5001 
3768
3 3768 1821 1608 
3768
3 3768 5029 2691 
3768
4 3768 1821 878 7293 
3768
4 3768 5029 5001 7275 
3768
4 3768 1821 1608 6223 
3768
4 3768 5029 2691 227 
3768
3 3768 6223 3809 
3768
4 3768 5029 5001 4675 
3768
...

result:

ok n=8000, OK

Test #25:

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

input:

10
add 3
3
add 7
3 7
add 10
3 10
add 1
3 7 1
add 9
3 10 9
add 5
3 7 5
add 4
3 10 4
add 8
3 7 1 8
add 6
3 10 9 6
add 2
3 7 5 2
delete 3
7 10 1 4
delete 7
10 9 5
delete 10
1 9 8 6
delete 1
9 5 4
delete 9
5 8 2
delete 5
4 8 6
delete 8
6 2
delete 6
2
delete 4
2
delete 2


output:

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

result:

ok n=10, OK

Test #26:

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

input:

10
add 10
10
add 8
10 8
add 4
10 4
add 3
3 10 8
add 6
3 6
add 1
3 10 1 8
add 7
3 7 6
add 2
3 10 4 2
add 9
3 7 9
add 5
3 10 1 5
delete 3
7 10 4 6
delete 10
1 4 8 2
delete 4
8 6
delete 1
5 8 2
delete 8
6 2
delete 7
9 5
delete 5
6
delete 6
2
delete 9
2
delete 2


output:

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

result:

ok n=10, OK

Test #27:

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

input:

1000
add 964
964
add 650
964 650
add 967
964 967
add 129
964 650 129
add 345
964 967 345
add 454
964 650 454
add 614
964 967 614
add 11
964 650 129 11
add 963
964 967 345 963
add 357
964 650 454 357
add 300
964 967 614 300
add 785
964 650 129 785
add 700
964 967 345 700
add 442
964 650 454 442
add 1...

output:

1 964 
964
2 964 650 
964
2 964 967 
964
3 964 650 129 
964
3 964 967 345 
964
3 964 650 454 
964
3 964 967 614 
964
4 964 650 129 11 
964
4 964 967 345 963 
964
4 964 650 454 357 
964
4 964 967 614 300 
964
4 964 650 129 785 
964
4 964 967 345 700 
964
4 964 650 454 442 
964
4 964 967 614 14 
964
5...

result:

ok n=1000, OK

Test #28:

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

input:

1000
add 871
871
add 449
449 871
add 644
644 449
add 97
97 644
add 853
853 97
add 496
496 853
add 418
418 496
add 207
207 418
add 401
401 207
add 519
519 401
add 276
276 519
add 576
576 276
add 74
74 576
add 194
194 74
add 719
719 194
add 252
252 719
add 718
718 252
add 137
137 718
add 292
292 137
a...

output:

1 871 
871
2 871 449 
449
2 449 644 
644
2 644 97 
97
2 97 853 
853
2 853 496 
496
2 496 418 
418
2 418 207 
207
2 207 401 
401
2 401 519 
519
2 519 276 
276
2 276 576 
576
2 576 74 
74
2 74 194 
194
2 194 719 
719
2 719 252 
252
2 252 718 
718
2 718 137 
137
2 137 292 
292
2 292 902 
902
2 902 530 ...

result:

ok n=1000, OK

Test #29:

score: 0
Accepted
time: 13ms
memory: 11008kb

input:

1000
add 986
986
add 800
986 800
add 897
986 897
add 601
601 986 800
add 858
858 601
add 627
858 627
add 398
858 601 398
add 124
858 124 627
add 885
858 885 601 986 800
add 554
858 124 554
add 234
858 885 234
add 482
858 124 482 627
add 489
858 885 601 986 489 800
add 771
858 124 554 771
add 508
858...

output:

1 986 
986
2 986 800 
986
2 986 897 
986
3 986 800 601 
601
2 601 858 
858
2 858 627 
858
3 858 601 398 
858
3 858 627 124 
858
5 858 601 986 800 885 
858
3 858 124 554 
858
3 858 885 234 
858
4 858 124 627 482 
858
6 858 885 601 986 800 489 
858
4 858 124 554 771 
858
4 858 885 234 508 
858
4 858 1...

result:

ok n=1000, OK

Test #30:

score: 0
Accepted
time: 32ms
memory: 11084kb

input:

1000
add 101
101
add 442
442 101
add 183
442 183
add 373
442 101 373
add 837
442 837 183
add 326
442 101 326
add 585
442 585 837
add 450
442 101 450 373
add 15
442 585 15
add 626
442 101 626 326
add 914
442 585 837 914
add 786
442 101 786 450
add 494
442 585 15 494
add 828
442 101 828 626
add 93
442...

output:

1 101 
101
2 101 442 
442
2 442 183 
442
3 442 101 373 
442
3 442 183 837 
442
3 442 101 326 
442
3 442 837 585 
442
4 442 101 373 450 
442
3 442 585 15 
442
4 442 101 326 626 
442
4 442 585 837 914 
442
4 442 101 450 786 
442
4 442 585 15 494 
442
4 442 101 626 828 
442
5 442 585 837 183 93 
442
4 ...

result:

ok n=1000, OK

Test #31:

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

input:

1000
add 79
79
add 442
442 79
add 454
454 442
add 520
454 520
add 101
454 442 101
add 343
454 343 520
add 585
454 442 79 585
add 700
454 700 343
add 632
454 442 101 632
add 300
454 300 700
add 878
454 442 79 878
add 64
454 300 64
add 227
454 442 101 227
add 964
964 454 300 700
add 828
964 828
add 48...

output:

1 79 
79
2 79 442 
442
2 442 454 
454
2 454 520 
454
3 454 442 101 
454
3 454 520 343 
454
4 454 442 79 585 
454
3 454 343 700 
454
4 454 442 101 632 
454
3 454 700 300 
454
4 454 442 79 878 
454
3 454 300 64 
454
4 454 442 101 227 
454
4 454 300 700 964 
964
2 964 828 
964
5 964 454 300 700 488 
96...

result:

ok n=1000, OK

Test #32:

score: 0
Accepted
time: 20ms
memory: 11116kb

input:

1000
add 964
964
add 871
964 871
add 449
964 449
add 644
964 644 871
add 97
964 97 449
add 853
964 853 644
add 496
964 496 97
add 418
964 418 853
add 207
964 207 496
add 401
964 401 418
add 519
964 519 207
add 276
964 276 401
add 576
964 576 519
add 74
964 74 276
add 194
964 194 576
add 719
964 719 ...

output:

1 964 
964
2 964 871 
964
2 964 449 
964
3 964 871 644 
964
3 964 449 97 
964
3 964 644 853 
964
3 964 97 496 
964
3 964 853 418 
964
3 964 496 207 
964
3 964 418 401 
964
3 964 207 519 
964
3 964 401 276 
964
3 964 519 576 
964
3 964 276 74 
964
3 964 576 194 
964
3 964 74 719 
964
3 964 194 252 
9...

result:

ok n=1000, OK

Test #33:

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

input:

8000
add 4964
4964
add 650
4964 650
add 6871
4964 6871
add 129
4964 650 129
add 3768
4964 6871 3768
add 1551
4964 650 1551
add 6223
4964 6871 6223
add 3875
4964 650 129 3875
add 6536
4964 6871 3768 6536
add 6438
4964 650 1551 6438
add 5015
4964 6871 6223 5015
add 2528
4964 650 129 2528
add 1952
4964...

output:

1 4964 
4964
2 4964 650 
4964
2 4964 6871 
4964
3 4964 650 129 
4964
3 4964 6871 3768 
4964
3 4964 650 1551 
4964
3 4964 6871 6223 
4964
4 4964 650 129 3875 
4964
4 4964 6871 3768 6536 
4964
4 4964 650 1551 6438 
4964
4 4964 6871 6223 5015 
4964
4 4964 650 129 2528 
4964
4 4964 6871 3768 1952 
4964
...

result:

ok n=8000, OK

Test #34:

score: 0
Accepted
time: 86ms
memory: 64960kb

input:

8000
add 3493
3493
add 5110
5110 3493
add 533
533 5110
add 1700
1700 533
add 4277
4277 1700
add 2368
2368 4277
add 4495
4495 2368
add 4305
4305 4495
add 6965
6965 4305
add 2503
2503 6965
add 4339
4339 2503
add 5195
5195 4339
add 2364
2364 5195
add 3802
3802 2364
add 1752
1752 3802
add 6812
6812 1752...

output:

1 3493 
3493
2 3493 5110 
5110
2 5110 533 
533
2 533 1700 
1700
2 1700 4277 
4277
2 4277 2368 
2368
2 2368 4495 
4495
2 4495 4305 
4305
2 4305 6965 
6965
2 6965 2503 
2503
2 2503 4339 
4339
2 4339 5195 
5195
2 5195 2364 
2364
2 2364 3802 
3802
2 3802 1752 
1752
2 1752 6812 
6812
2 6812 2956 
2956
2 ...

result:

ok n=8000, OK

Test #35:

score: 0
Accepted
time: 136ms
memory: 66072kb

input:

8000
add 1338
1338
add 1220
1338 1220
add 2046
1338 2046
add 5158
5158 1338 1220
add 1439
5158 1439
add 412
5158 1338 412 1220
add 5737
5737 5158 1439
add 3968
5737 3968
add 703
5737 5158 703 1439
add 2858
5737 2858 3968
add 2783
5737 5158 1338 2046 2783
add 3798
5737 2858 3798
add 5455
5737 5158 70...

output:

1 1338 
1338
2 1338 1220 
1338
2 1338 2046 
1338
3 1338 1220 5158 
5158
2 5158 1439 
5158
4 5158 1338 1220 412 
5158
3 5158 1439 5737 
5737
2 5737 3968 
5737
4 5737 5158 1439 703 
5737
3 5737 3968 2858 
5737
5 5737 5158 1338 2046 2783 
5737
3 5737 2858 3798 
5737
4 5737 5158 703 5455 
5737
4 5737 28...

result:

ok n=8000, OK

Test #36:

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

input:

8000
add 6131
6131
add 4520
6131 4520
add 6799
6131 6799
add 1676
6131 4520 1676
add 1844
6131 1844 6799
add 6912
6131 4520 6912
add 3621
6131 3621 1844
add 4018
4018 6131 4520 1676
add 1178
4018 1178
add 2082
4018 6131 4520 1676 2082
add 6172
6172 4018 1178
add 1568
6172 1568
add 7404
6172 4018 117...

output:

1 6131 
6131
2 6131 4520 
6131
2 6131 6799 
6131
3 6131 4520 1676 
6131
3 6131 6799 1844 
6131
3 6131 4520 6912 
6131
3 6131 1844 3621 
6131
4 6131 4520 1676 4018 
4018
2 4018 1178 
4018
5 4018 6131 4520 1676 2082 
4018
3 4018 1178 6172 
6172
2 6172 1568 
6172
4 6172 4018 1178 7404 
6172
3 6172 1568...

result:

ok n=8000, OK

Test #37:

score: 0
Accepted
time: 159ms
memory: 66008kb

input:

8000
add 893
893
add 2960
2960 893
add 7459
7459 2960
add 111
111 7459
add 1185
111 1185
add 3327
111 7459 3327
add 5397
5397 111 1185
add 3963
5397 3963
add 4988
5397 111 1185 4988
add 6640
5397 6640 3963
add 3584
5397 111 7459 2960 3584
add 5536
5397 5536 6640
add 6178
5397 111 1185 6178
add 1119
...

output:

1 893 
893
2 893 2960 
2960
2 2960 7459 
7459
2 7459 111 
111
2 111 1185 
111
3 111 7459 3327 
111
3 111 1185 5397 
5397
2 5397 3963 
5397
4 5397 111 1185 4988 
5397
3 5397 3963 6640 
5397
5 5397 111 7459 2960 3584 
5397
3 5397 6640 5536 
5397
4 5397 111 1185 6178 
5397
3 5397 5536 1119 
5397
5 5397...

result:

ok n=8000, OK

Test #38:

score: 0
Accepted
time: 119ms
memory: 66240kb

input:

8000
add 3768
3768
add 355
3768 355
add 5755
3768 5755
add 5029
3768 5029 355
add 5530
3768 5755 5530
add 7826
3768 5029 7826
add 6194
3768 5755 6194
add 1821
3768 1821 5029 355
add 1113
3768 5755 5530 1113
add 5015
3768 5015 1821
add 343
3768 343 5755 6194
add 650
650 3768 5015
add 878
650 878
add ...

output:

1 3768 
3768
2 3768 355 
3768
2 3768 5755 
3768
3 3768 355 5029 
3768
3 3768 5755 5530 
3768
3 3768 5029 7826 
3768
3 3768 5755 6194 
3768
4 3768 5029 355 1821 
3768
4 3768 5755 5530 1113 
3768
3 3768 1821 5015 
3768
4 3768 5755 6194 343 
3768
3 3768 5015 650 
650
2 650 878 
650
4 650 3768 5015 6641...

result:

ok n=8000, OK

Test #39:

score: 0
Accepted
time: 154ms
memory: 66224kb

input:

8000
add 3325
3325
add 5911
3325 5911
add 664
3325 664
add 708
3325 5911 708
add 3589
3325 3589 664
add 3869
3325 3869 5911
add 6353
3325 6353 3589
add 5408
3325 3869 5408
add 2396
3325 6353 2396
add 1926
3325 3869 1926 5911
add 3822
3325 6353 3589 3822
add 2476
3325 3869 5408 2476
add 6482
3325 635...

output:

1 3325 
3325
2 3325 5911 
3325
2 3325 664 
3325
3 3325 5911 708 
3325
3 3325 664 3589 
3325
3 3325 5911 3869 
3325
3 3325 3589 6353 
3325
3 3325 3869 5408 
3325
3 3325 6353 2396 
3325
4 3325 3869 5911 1926 
3325
4 3325 6353 3589 3822 
3325
4 3325 3869 5408 2476 
3325
4 3325 6353 2396 6482 
3325
4 33...

result:

ok n=8000, OK

Test #40:

score: 0
Accepted
time: 157ms
memory: 66172kb

input:

8000
add 520
520
add 4857
4857 520
add 3380
4857 3380
add 5397
4857 520 5397
add 1551
1551 4857 3380
add 4675
1551 4675
add 5755
1551 4857 5755 3380
add 2691
1551 4675 2691
add 3809
1551 3809 4857 520
add 1608
1551 4675 1608
add 4679
1551 3809 4679
add 6194
1551 4675 6194 2691
add 6223
1551 6223 380...

output:

1 520 
520
2 520 4857 
4857
2 4857 3380 
4857
3 4857 520 5397 
4857
3 4857 3380 1551 
1551
2 1551 4675 
1551
4 1551 4857 3380 5755 
1551
3 1551 4675 2691 
1551
4 1551 4857 520 3809 
1551
3 1551 4675 1608 
1551
3 1551 3809 4679 
1551
4 1551 4675 2691 6194 
1551
5 1551 3809 4857 520 6223 
1551
4 1551 ...

result:

ok n=8000, OK

Test #41:

score: 0
Accepted
time: 127ms
memory: 66304kb

input:

8000
add 3540
3540
add 6114
6114 3540
add 7095
6114 7095
add 7142
6114 3540 7142
add 4694
6114 7095 4694
add 1040
6114 3540 1040
add 2503
6114 7095 2503
add 5498
6114 3540 7142 5498
add 4061
6114 7095 4061 4694
add 213
6114 3540 1040 213
add 300
6114 300 7095 2503
add 20
6114 3540 20 7142
add 2632
2...

output:

1 3540 
3540
2 3540 6114 
6114
2 6114 7095 
6114
3 6114 3540 7142 
6114
3 6114 7095 4694 
6114
3 6114 3540 1040 
6114
3 6114 7095 2503 
6114
4 6114 3540 7142 5498 
6114
4 6114 7095 4694 4061 
6114
4 6114 3540 1040 213 
6114
4 6114 7095 2503 300 
6114
4 6114 3540 7142 20 
6114
3 6114 300 2632 
2632
2...

result:

ok n=8000, OK

Test #42:

score: 0
Accepted
time: 130ms
memory: 66084kb

input:

8000
add 6663
6663
add 7408
7408 6663
add 2088
2088 7408
add 1213
2088 1213
add 3752
3752 2088 7408
add 4898
3752 4898
add 6916
3752 2088 7408 6916
add 3470
3470 3752 4898
add 6588
3470 6588
add 6136
3470 3752 6136 4898
add 3508
3508 3470 6588
add 3236
3508 3236
add 5297
3508 3470 6588 5297
add 4892...

output:

1 6663 
6663
2 6663 7408 
7408
2 7408 2088 
2088
2 2088 1213 
2088
3 2088 7408 3752 
3752
2 3752 4898 
3752
4 3752 2088 7408 6916 
3752
3 3752 4898 3470 
3470
2 3470 6588 
3470
4 3470 3752 4898 6136 
3470
3 3470 6588 3508 
3508
2 3508 3236 
3508
4 3508 3470 6588 5297 
3508
3 3508 3236 4892 
3508
6 3...

result:

ok n=8000, OK

Test #43:

score: 0
Accepted
time: 99ms
memory: 65744kb

input:

8000
add 6663
6663
add 2364
6663 2364
add 7626
6663 7626
add 131
131 6663 2364
add 6567
131 6567
add 6812
131 6663 6812 2364
add 4718
131 6567 4718
add 1312
1312 131 6663 7626
add 5091
1312 5091
add 4819
4819 1312 131 6663 7626
add 1421
4819 1421
add 2361
4819 1312 131 6663 2361 7626
add 3596
4819 3...

output:

1 6663 
6663
2 6663 2364 
6663
2 6663 7626 
6663
3 6663 2364 131 
131
2 131 6567 
131
4 131 6663 2364 6812 
131
3 131 6567 4718 
131
4 131 6663 7626 1312 
1312
2 1312 5091 
1312
5 1312 131 6663 7626 4819 
4819
2 4819 1421 
4819
6 4819 1312 131 6663 7626 2361 
4819
3 4819 1421 3596 
4819
4 4819 1312 ...

result:

ok n=8000, OK

Test #44:

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

input:

8000
add 4339
4339
add 615
615 4339
add 7105
615 7105
add 4718
615 4718 4339
add 2503
615 7105 2503
add 4810
615 4810 4718
add 6965
615 7105 6965
add 1700
615 4810 1700
add 533
615 7105 2503 533
add 3145
615 3145 4810 4718
add 6288
6288 615 7105 6965
add 2496
6288 2496
add 4305
6288 615 7105 6965 43...

output:

1 4339 
4339
2 4339 615 
615
2 615 7105 
615
3 615 4339 4718 
615
3 615 7105 2503 
615
3 615 4718 4810 
615
3 615 7105 6965 
615
3 615 4810 1700 
615
4 615 7105 2503 533 
615
4 615 4810 4718 3145 
615
4 615 7105 6965 6288 
6288
2 6288 2496 
6288
5 6288 615 7105 6965 4305 
6288
3 6288 2496 3187 
6288...

result:

ok n=8000, OK

Test #45:

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

input:

8000
add 4964
4964
add 3493
4964 3493
add 5110
4964 5110
add 533
4964 533 3493
add 1700
4964 1700 5110
add 4277
4964 4277 533
add 2368
4964 2368 1700
add 4495
4964 4495 4277
add 4305
4964 4305 2368
add 6965
4964 6965 4495
add 2503
4964 2503 4305
add 4339
4964 4339 6965
add 5195
4964 5195 2503
add 23...

output:

1 4964 
4964
2 4964 3493 
4964
2 4964 5110 
4964
3 4964 3493 533 
4964
3 4964 5110 1700 
4964
3 4964 533 4277 
4964
3 4964 1700 2368 
4964
3 4964 4277 4495 
4964
3 4964 2368 4305 
4964
3 4964 4495 6965 
4964
3 4964 4305 2503 
4964
3 4964 6965 4339 
4964
3 4964 2503 5195 
4964
3 4964 4339 2364 
4964
...

result:

ok n=8000, OK