QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#439130#8787. Unusual Caseucup-team1525AC ✓302ms7572kbC++203.4kb2024-06-11 16:38:382024-06-11 16:38:39

Judging History

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

  • [2024-06-11 16:38:39]
  • 评测
  • 测评结果:AC
  • 用时:302ms
  • 内存:7572kb
  • [2024-06-11 16:38:38]
  • 提交

answer

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

const int N = 10050;

int n, m, k;
vector<int> e[N];
vector<vector<int>> ans;
mt19937 rnd(1);

int main() {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        e[u].push_back(v), e[v].push_back(u);
    }

    while (true) {
        vector<int> vec;
        int root = rnd() % n + 1;
        vector<bool> vis(n + 5, 0);
        vector<int> pos(n + 5, 0);
        vis[root] = 1;
        int las = 0;
        vec.push_back(root);
        cerr << "find path: " << ans.size() << endl;

        int cnt = 0;
        
        while (true) {
            // cnt++;
            // if (cnt >= 30000) break;
            int u = vec.back();
            shuffle(e[u].begin(), e[u].end(), rnd);
            // cout << vec.size() << endl;
            bool flag = false;
            for (auto v : e[u]) {
                if (vis[v]) continue;
                flag = true;
                vis[v] = 1;
                pos[v] = vec.size();
                vec.push_back(v);
                las = u;
                break;
            }
            if (!flag) {
                // shuffle(e[u].begin(), e[u].end(), rnd);
                for (auto v : e[u]) {
                    if (v == las) continue;
                    if (!vis[v]) continue;
                    int l = pos[v];
                    if (l + 1 > vec.size() || l == 0) continue;
                    
                    // bool flag2 = 0;
                    // vector<int> vec2;
                    // shuffle(e[vec[l - 1]].begin(), e[vec[l - 1]].end(), rnd);
                    // for (auto v2 : e[vec[l - 1]]) {
                    //     if (!vis[v2] || pos[v2] <= l) continue;
                    //     int r = pos[v2];
                    //     flag2 = 1;
                    //     for (int i = 0; i < l; i++) vec2.push_back(vec[i]);
                    //     for (int i = r; i < (int)vec.size(); i++) vec2.push_back(vec[i]);
                    //     for (int i = l; i < r; i++) vec2.push_back(vec[i]);
                    //     assert(vec.size() == vec2.size());
                    //     vec = move(vec2);
                    //     for (int i = 0; i < (int)vec.size(); i++) pos[vec[i]] = i;
                    //     las = vec[(int)vec.size() - 2];
                    //     break;
                    // }
                    // if (flag2) break;

                    reverse(vec.begin() + l + 1, vec.end());
                    for (int i = 0; i < (int)vec.size(); i++) pos[vec[i]] = i;
                    break;
                }
            }
            if (vec.size() == n) break;
        }
        cerr << "find over " << (vec.size() == n) << endl;
        if (vec.size() != n) continue;
        ans.push_back(vec);
        for (int i = 0; i + 1 < vec.size(); i++) {
            auto it = find(e[vec[i]].begin(), e[vec[i]].end(), vec[i + 1]);
            if (it != e[vec[i]].end())
                e[vec[i]].erase(it);
            auto it2 = find(e[vec[i + 1]].begin(), e[vec[i + 1]].end(), vec[i]);
            if (it2 != e[vec[i + 1]].end())
                e[vec[i + 1]].erase(it2);
        }
        if (ans.size() == k) break;
    }

    for (auto ans2: ans) {
        for (int i = 0; i < ans2.size(); i++)
            printf("%d%c", ans2[i], " \n"[i + 1 == (int)ans2.size()]);
    }

    return 0;
}

詳細信息

Test #1:

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

input:

5 9 2
1 3
1 4
1 5
2 3
2 4
2 5
3 5
4 3
5 4

output:

1 3 2 5 4
2 4 3 5 1

result:

ok OK (n = 5, m = 9)

Test #2:

score: 0
Accepted
time: 238ms
memory: 7560kb

input:

10000 200000 8
6318 9948
9588 8985
4252 4927
1146 9347
2276 7434
9612 4436
8319 1837
4428 1043
5976 2759
879 1564
7866 4849
2070 5310
8407 156
7306 7766
9100 1576
1181 6122
7790 7065
3235 8877
5661 9718
1555 743
5479 9755
2601 8190
3318 2067
4084 8193
1050 269
64 5504
3416 5041
7169 197
2158 2523
57...

output:

5846 7678 2557 1399 6331 6053 6700 3060 8193 8513 1483 1202 3810 8557 6792 8105 5363 1158 4160 6726 2363 2639 374 5689 7431 2449 8960 2211 2141 2378 7294 9101 2050 777 5038 3100 4361 8573 9611 3989 9159 4652 3676 3559 1054 3990 2624 4244 3427 11 5546 2820 2090 8725 5067 5573 5657 127 2373 1489 9001 ...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 220ms
memory: 7276kb

input:

10000 200000 8
7826 9720
8400 2487
6964 6011
4799 6032
3696 3691
7883 4350
9092 3892
3588 7409
6005 4538
4196 7873
4216 4505
6339 1269
2405 5423
9 7030
8193 7285
5782 2768
5646 4946
4483 6857
3431 9325
4243 488
2435 8371
3067 1462
8592 4932
8581 3147
1394 6751
2499 4977
4806 1190
9652 5059
4075 3454...

output:

5846 3713 5069 9379 3742 1641 9152 8626 6409 3520 6969 7049 5915 5228 1838 1433 7840 1006 6923 1654 5939 2274 5823 2376 7454 7946 1170 3379 9899 3383 5412 3435 5381 4202 5440 4065 3694 6562 717 1827 5606 4313 343 742 7031 4764 3153 2620 3325 4464 407 8 4150 704 4335 9306 9949 7677 4494 7631 3397 553...

result:

ok OK (n = 10000, m = 200000)

Test #4:

score: 0
Accepted
time: 220ms
memory: 7296kb

input:

10000 200000 8
6064 4200
2244 5165
648 6303
9246 8103
4187 7801
761 3539
6105 2254
4471 3158
6006 4452
3580 8120
9391 3711
8752 1014
2511 151
800 2285
5388 3282
4704 8712
5372 5509
6988 6976
9314 9056
2225 9256
8567 3853
4135 3386
9688 1467
7287 5856
8107 7114
2385 3663
2991 2969
3746 7352
8828 6735...

output:

5846 958 3737 2349 4016 1719 6912 8226 5178 9350 281 7962 3255 1940 4129 7630 1820 2491 9607 5506 789 9294 9134 9155 9504 2048 2737 1558 3634 2916 1037 6611 8153 4208 5642 3566 9319 6171 2018 9886 6049 4340 9216 2802 1788 4018 8565 3326 3864 7044 6536 6453 1955 9233 6163 5189 8773 9229 146 1573 9304...

result:

ok OK (n = 10000, m = 200000)

Test #5:

score: 0
Accepted
time: 223ms
memory: 7272kb

input:

10000 200000 8
1034 3387
1120 7020
5302 5802
4487 5560
3749 9763
8246 2002
9358 6922
7077 8289
5976 2501
9030 2306
3390 2468
9307 4546
8724 4342
9679 3531
684 9564
7946 3956
6968 8754
748 9234
3310 8909
5500 7046
3874 6201
5806 3962
6604 1672
203 6318
1189 1358
9723 1561
7970 380
9450 7078
6420 2366...

output:

5846 1606 9939 2217 1773 1482 5090 9163 3751 3714 5059 2266 4884 2982 4195 947 625 5997 4367 9964 248 3085 2242 40 7288 5784 8424 5896 1471 1991 7149 621 6430 5674 1274 2796 9159 7065 8489 325 3051 8361 5411 5357 8072 1840 1619 6850 467 4663 535 2500 5225 1378 3426 1723 6298 4576 1002 187 9638 1426 ...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 197ms
memory: 7284kb

input:

10000 200000 8
2734 7281
5027 8050
927 4507
523 8404
2382 9578
337 9740
8851 7897
1407 2803
5918 8684
547 430
6215 775
8004 1864
1045 7995
6645 767
4082 6133
5510 8499
433 4681
5763 3631
5419 8885
4068 3859
8356 5416
8078 3190
9342 5547
7329 4533
639 9483
4511 8673
9744 3422
6765 4236
6849 346
2288 ...

output:

5846 97 921 2001 2775 3893 1150 4777 5347 2376 8887 7659 5710 2551 1790 8408 795 5255 522 584 6966 3990 5088 692 167 5123 9842 5423 657 3976 4536 6351 3377 7851 6394 3953 9363 3787 5929 6848 6661 6668 5790 5078 9086 9649 79 3220 6918 1991 322 551 9495 3680 7816 1696 6111 3811 5215 9523 9148 2477 158...

result:

ok OK (n = 10000, m = 200000)

Test #7:

score: 0
Accepted
time: 230ms
memory: 7268kb

input:

10000 200000 8
1166 5882
3966 8257
7523 2420
7353 6633
87 7247
7035 6751
4585 5179
7460 6699
5829 3002
8131 2493
7864 8632
4845 2969
9472 1110
1698 3993
5582 2988
7395 2341
5768 3290
2034 167
5642 8983
7929 9694
2014 1497
952 1069
7900 3092
8663 502
6458 1489
6751 4998
8312 2094
5690 8825
115 676
62...

output:

5846 7717 4456 8422 5450 948 8153 1199 7362 4844 1475 5643 315 7984 991 2539 5106 9183 2320 1823 3443 2301 1598 2621 3008 7202 2017 1349 2524 7184 7838 8788 8516 4721 4628 8496 7898 2770 4733 7390 7811 3727 8822 2356 3245 4250 5364 5566 1216 6812 6249 9480 6697 9801 2984 1611 8633 1156 1824 4906 428...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 214ms
memory: 7556kb

input:

10000 200000 8
6328 9191
7937 7640
5090 9539
4977 248
6863 2768
8341 3037
6559 8768
5237 9978
5712 5454
1782 8494
8338 6040
9828 7861
4008 3687
4839 3210
5183 130
3601 5482
2972 4581
9560 8842
3978 9205
7084 4551
4847 4445
4428 7601
2280 4306
4207 4225
8646 7376
6443 536
3674 6398
6226 847
6219 3356...

output:

5846 5946 5804 2832 2400 4614 4227 331 5260 7652 8260 6607 7040 929 4807 9353 9552 2171 8184 5172 4149 289 4803 2587 2729 7897 5547 2767 1647 2464 7351 413 5740 5974 6396 5050 393 5837 3807 9570 4606 6394 7436 5088 7606 8804 723 6684 2728 5075 3164 2882 3620 7494 8868 6693 271 8384 4472 4489 8319 50...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 222ms
memory: 7568kb

input:

10000 200000 8
8222 7206
6939 6199
3627 5866
3396 9250
2710 6141
4253 8597
4773 8663
4738 2640
5564 6042
1500 8433
7637 2998
2954 6540
4650 5727
6068 8417
2885 7557
4129 7922
2046 8554
8343 9655
428 9550
1531 8431
6855 4259
8506 2784
2481 9190
3961 5701
7203 7144
3585 5286
5830 6332
8372 300
5160 83...

output:

5846 4409 8021 1131 7920 302 2276 6840 901 4367 6783 2694 4904 2945 7599 3107 7936 8766 5989 4336 2544 7804 7977 3476 4426 713 2079 791 1337 4911 2871 5070 8736 4587 1324 9550 1234 2339 5285 2844 5699 6247 1754 9472 1379 256 3896 9597 3616 32 9333 8045 8631 4548 3205 4994 3284 7444 144 890 6301 95 6...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 234ms
memory: 7380kb

input:

10000 200000 8
6846 9929
974 3935
3136 1399
2610 3637
7628 7368
4772 3431
9227 4865
5962 4684
5388 4763
7285 2311
5760 9506
4223 9005
1401 7229
5384 9615
8690 5272
8977 9661
2990 5210
8380 2608
4990 18
1272 1334
8039 940
3186 6620
8503 7744
7924 4930
2128 794
8179 9250
4781 1898
2129 7185
6939 5764
...

output:

5846 4759 2296 6586 2365 6675 9173 9769 7310 1102 4803 911 685 4959 4243 7073 5558 8713 745 7056 5976 1130 6939 4068 8615 7365 7856 2099 4252 8416 6745 310 776 8008 6977 7944 4904 7237 9280 5855 4960 7589 673 2448 7086 7606 5187 3945 1254 7136 5889 3066 808 7836 9869 178 9287 5424 342 2567 8316 3445...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 242ms
memory: 7300kb

input:

10000 200000 8
2202 7359
40 846
3615 6140
2618 3411
1618 6447
9897 7539
9921 7374
8909 6111
5182 1620
9136 127
2709 5565
3635 5257
4258 8192
2787 6804
2596 3272
8146 700
5803 4547
9673 7699
7666 608
6306 3259
8398 4487
8468 9107
347 9968
6096 1913
3422 8324
225 2426
526 3095
7496 1502
1556 5493
1173...

output:

5846 9968 6846 8410 9587 6590 6870 1503 6048 1222 737 5977 5909 9400 9989 9673 3797 3587 4780 5252 2119 5219 3979 1563 4624 7207 597 9894 5489 1611 4317 8874 5933 2236 2130 669 5510 2917 5965 4011 4971 8630 2835 7483 6927 8296 4080 6833 2285 4921 4014 8304 6259 9984 2801 8559 8387 7189 3492 1110 157...

result:

ok OK (n = 10000, m = 200000)

Test #12:

score: 0
Accepted
time: 218ms
memory: 7240kb

input:

10000 200000 8
4288 9496
4137 6934
5065 87
3420 8570
4679 3379
9630 921
6856 6189
3580 6921
4946 6611
7054 1882
8482 1173
1189 5296
3223 8618
8278 9983
4603 1559
1637 1037
487 6567
2222 4930
8456 1322
6633 4206
7932 4900
4352 246
8011 5862
8478 6650
1085 9736
9721 4816
3066 9922
4474 3251
9010 7571
...

output:

5846 2385 4296 7051 6073 3611 6036 8041 7512 1254 9210 6709 2867 1759 8132 6145 132 2133 5837 8482 9396 4396 907 3222 2883 2455 4021 9093 5149 9484 9477 8630 4218 8598 434 4476 925 636 7424 4124 4342 2340 8991 6998 6202 4941 9062 5085 2758 1617 1729 145 2396 1626 4994 1094 7136 8737 9009 847 8 6730 ...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 216ms
memory: 7276kb

input:

10000 200000 8
3105 6341
3267 2198
7486 3241
5017 9116
6811 8164
3970 3578
30 1311
9975 7113
4681 9737
1039 7576
3081 6333
6886 9121
8295 8507
1857 9152
4712 132
9449 674
7039 1268
6027 4299
7358 2158
2254 4176
6642 2180
838 38
1497 5426
5069 9140
5117 5029
6669 6418
2399 2381
3063 2432
9302 1999
61...

output:

5846 1330 9559 9729 8773 8334 3545 4841 4225 7689 9737 6988 8239 1440 4203 5319 3708 3132 6653 9068 8345 8829 9641 2645 4193 6875 718 5923 4610 9194 1050 1260 3982 8099 5756 4341 8323 2389 32 4238 7858 3821 6687 3734 2735 4525 5253 479 4628 5700 7152 7521 6020 5311 2615 8147 9653 969 153 1815 8249 6...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 212ms
memory: 7300kb

input:

10000 200000 8
8654 7892
7428 6639
878 5603
7408 5048
8014 802
2916 5509
9445 2740
8092 6688
4386 998
1091 7207
6504 1042
726 6733
9475 7857
3523 4312
2923 8991
1582 9609
5462 8652
1087 5808
4374 3117
3167 3169
4526 6326
7925 8481
804 8660
5869 9384
5517 4202
1069 7233
8527 470
3262 9045
2431 8777
5...

output:

5846 3210 7334 4275 9524 599 5394 2784 7326 8684 7703 230 5650 6893 2822 2430 2606 5131 1564 8475 1551 6915 8876 3973 4175 8633 8450 4680 7156 3402 2643 7166 2274 9812 8255 2281 2935 6297 8371 8453 2529 3844 7443 2258 6434 6769 4529 9976 4032 2548 5147 3309 1286 2265 39 2411 6081 3865 9050 9082 5229...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 200ms
memory: 7348kb

input:

10000 200000 8
933 4151
6621 255
5240 7171
594 6365
8289 1293
6469 6714
5100 476
7934 5646
4062 393
7210 778
8752 5302
2709 8132
6762 6670
3277 5462
9235 8137
8036 7844
5754 8718
7402 9455
9503 4199
9374 1184
1587 7339
5615 5576
5932 5563
879 7381
2286 7257
2919 7262
1450 4191
5071 3090
8398 7904
28...

output:

5846 5395 8246 209 9009 5166 9215 2650 5461 7835 8203 5582 3495 7891 3318 9045 4884 4790 5077 34 9074 6886 903 9175 1886 8252 6454 8712 1917 6606 3354 3884 4818 2877 4676 8319 682 2871 6451 2119 4724 5243 7537 3395 1444 9655 9795 6652 9288 4821 5901 8112 1283 5769 4448 4022 9721 3716 1982 1157 7443 ...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 221ms
memory: 7300kb

input:

10000 200000 8
9943 5117
846 3048
573 7946
4574 3069
7634 9636
4629 7193
6995 4518
9499 3986
3709 7923
9395 8286
9824 9113
2834 3317
156 4944
1118 2603
3649 7569
8811 5378
7915 1466
4973 5241
2746 5405
874 8222
7822 5218
3907 1322
6881 6137
98 3131
5423 4193
2221 6503
1167 3542
8491 4566
7202 9381
8...

output:

5846 2973 3415 8842 5202 5218 683 3475 5263 2378 5823 6195 445 5137 5839 3882 406 609 5956 1373 1686 5408 478 9427 1472 8621 2570 5758 7730 1380 7164 8551 7901 3925 5241 6440 2650 1489 8573 1668 3390 9410 7521 8860 9434 9439 1281 4725 8682 5107 2914 5312 4407 5396 5154 7585 7250 709 5930 4869 612 96...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 216ms
memory: 7292kb

input:

10000 200000 8
5685 790
102 5017
6877 7928
9348 5159
6051 5832
7396 6946
5130 4867
2787 1709
3325 3587
7648 9733
9722 2473
1102 2289
9658 2681
7046 5735
6164 7288
3907 2211
1947 6896
3800 3166
4102 6733
7667 4282
3233 9964
2800 5721
3651 380
3526 6635
4930 5010
8974 4957
7678 8525
3522 3474
8844 320...

output:

5846 5694 3042 7661 5641 4750 8161 9220 7234 7064 2928 5770 346 4962 8296 1875 8907 4791 6777 1432 4304 7057 7157 8094 9836 1691 6402 6323 8730 6925 5565 6831 6506 8627 8065 3100 4612 1576 3567 6425 7946 1040 90 1939 9476 1007 8686 6040 9350 4671 815 677 6209 5831 6175 6983 2183 8332 3206 9720 4908 ...

result:

ok OK (n = 10000, m = 200000)

Test #18:

score: 0
Accepted
time: 229ms
memory: 7272kb

input:

10000 200000 8
8157 1170
4391 6162
4152 7117
4917 2635
3540 9882
4770 5974
9506 1523
7799 8814
2913 7387
1967 5119
8444 5384
7513 5048
5267 9880
1062 4857
6781 7292
3324 8343
7848 5008
3882 3230
3571 8184
9753 9364
7819 1576
2296 8772
6243 8293
1164 7893
805 9708
3179 2624
983 9138
163 9815
3323 938...

output:

5846 1141 8367 554 2764 2730 7660 222 6275 5880 9315 4077 1080 85 1424 1743 3884 6329 4842 5077 3619 2736 7600 4180 2854 6984 3217 712 8432 6082 4813 5384 5177 3226 5963 8833 9935 8200 8246 9356 7839 2325 6594 8366 1674 8018 7374 3 8615 907 5119 7876 1794 1353 6826 448 7093 7728 2620 986 5064 7869 3...

result:

ok OK (n = 10000, m = 200000)

Test #19:

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

input:

10000 200000 8
7360 6258
3711 6484
2398 5513
1280 5497
99 1783
6751 4276
121 4485
4535 5302
2471 9321
2353 4443
5992 7845
2067 1594
6983 6541
3166 9969
5499 7584
7063 3774
5618 5802
5220 5433
1153 9758
7132 3469
1580 55
2393 474
4655 9876
3012 6904
3048 8287
4835 9504
1083 5383
8414 3587
640 7909
12...

output:

5846 6098 1057 9095 3316 7413 7642 9031 2668 2723 2713 6614 1507 479 7231 3777 3225 4491 5128 1954 8494 5949 7412 1666 1663 430 2689 4997 4136 4841 9532 7842 8133 8581 578 4466 5275 5816 6452 8315 3809 4352 1692 9028 8444 224 1407 5433 9559 6994 6769 7468 3395 8981 373 4835 595 7533 9373 1809 1719 4...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 207ms
memory: 7276kb

input:

10000 200000 8
3294 6053
8062 5981
1615 3116
8438 3745
5730 1538
3338 1852
6977 3755
2994 1173
1999 9389
8805 7705
2364 9857
4763 1926
4807 2665
3357 1072
2320 8161
5122 8504
5259 9278
7813 9775
6849 1454
9805 6597
4517 5400
3093 829
8889 5129
9068 3669
1661 747
3942 5597
7977 7258
8276 4791
794 878...

output:

5846 2206 3718 9486 9285 6767 6110 9807 8136 9222 581 5897 579 1460 3892 7522 4561 9519 7573 6173 4930 565 3776 8756 8784 6231 5193 5363 9392 430 7988 12 2621 8386 7373 6204 5069 4362 6053 5894 5647 6680 2298 126 5320 5376 290 2309 91 4364 519 5457 3595 4127 7483 5551 444 2540 1334 1394 7604 6230 99...

result:

ok OK (n = 10000, m = 200000)

Test #21:

score: 0
Accepted
time: 198ms
memory: 7304kb

input:

10000 200000 8
5960 554
7446 4655
1802 9926
6390 7380
432 9145
4532 8702
73 9330
3176 6426
1498 7593
1325 4906
7561 1419
5603 6045
8738 8250
1636 8165
7241 9025
7503 2533
6769 5436
1662 6255
658 3274
7771 8747
6629 7611
4394 9835
8944 4052
9334 8187
6642 7088
500 903
1665 4765
9749 3427
3786 2010
29...

output:

5846 9585 4144 5263 7311 6849 5858 8671 9260 6600 7815 2394 3175 2981 7293 4228 7123 6054 5235 4308 2625 9278 6554 3815 8856 3223 241 8822 8979 9360 430 8838 2161 4823 7463 8448 347 4852 3074 182 572 111 3315 7392 1001 4425 4463 6770 7360 8171 7112 1603 2142 1745 7607 167 1654 3749 4552 7224 3785 72...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 216ms
memory: 7280kb

input:

10000 200000 8
5356 9763
1861 2505
2960 5943
5137 6400
4205 4606
334 4826
9409 1213
5082 1062
968 3931
9911 6045
1583 2531
4585 3950
8777 3298
8002 1249
265 175
4205 5862
148 4277
6766 4875
2580 5217
1030 9919
7916 6689
6297 7493
4820 6644
3810 458
7992 7311
4510 5422
2148 7902
2832 9495
9616 7585
5...

output:

5846 9336 834 9247 5492 5769 7932 1612 7844 6303 6182 3931 3046 7615 7841 709 7461 593 2530 2696 930 1653 578 376 6895 7259 1194 5678 8195 507 8663 6308 571 3567 3215 4437 6571 8095 9521 4452 7099 9997 5116 6860 1211 5197 6414 6324 1028 9879 4386 5773 8563 6757 485 8333 4457 6011 694 8286 1403 8042 ...

result:

ok OK (n = 10000, m = 200000)

Test #23:

score: 0
Accepted
time: 302ms
memory: 7300kb

input:

10000 200000 8
1483 3680
1308 9532
5089 1166
4678 806
7049 7919
742 225
4985 9402
8711 5081
408 8403
4565 1123
4429 3193
1709 5643
4923 7808
2456 324
1389 1611
5228 8489
5397 5799
3126 5633
2616 7282
9582 114
8379 2634
8802 3804
6517 2907
2495 483
5711 1414
5972 9154
9425 6671
7526 2994
8283 5509
64...

output:

5846 2090 4401 9046 5336 7996 2959 6714 910 722 2964 2773 1353 9226 4255 7787 3698 226 7859 8684 9705 9338 3408 3452 3440 1270 6927 9700 7735 5984 6614 6193 3256 8856 1730 5957 410 7763 6664 9035 295 730 7198 3169 3338 9105 6952 6449 2195 4770 4023 6547 1599 1168 4901 5971 8663 7654 7492 8510 3547 5...

result:

ok OK (n = 10000, m = 200000)

Test #24:

score: 0
Accepted
time: 237ms
memory: 7572kb

input:

10000 200000 8
4341 2303
5786 5734
8189 5597
5013 599
8965 9085
5757 4898
6801 3898
4064 8482
9819 1010
5285 139
6101 3406
6977 1121
7176 1780
4997 5389
616 3334
572 416
2516 4
742 8531
765 9471
3427 9332
8017 5445
1909 8766
4035 2839
5389 8262
9798 9399
4884 2098
3496 1070
3830 3926
9787 5783
4993 ...

output:

5846 8690 7044 9396 6505 4433 6851 6535 1613 6084 3147 91 3291 3174 8872 1814 6767 6834 7187 5682 1267 9858 2803 9270 6871 1072 76 8577 4106 2302 6573 5881 5506 8563 2144 2096 5676 4344 9217 4338 2603 2102 4163 2518 5514 670 9398 1052 1591 922 5460 2842 919 3797 8472 5432 9253 3440 4751 1526 3670 56...

result:

ok OK (n = 10000, m = 200000)

Test #25:

score: 0
Accepted
time: 185ms
memory: 7364kb

input:

10000 200000 8
3930 5634
5297 1113
2260 9235
6143 5777
9951 8103
5378 8844
4858 4701
1141 1266
9200 1752
2072 3094
6597 3169
5537 5214
5626 6444
7944 5343
237 1641
1505 6890
9613 3567
7027 1782
2566 7572
6830 5122
5618 2380
7375 6441
2493 3794
254 1264
1248 4256
4362 1100
1744 2290
4130 8407
1501 86...

output:

5846 4061 6994 5515 7922 9226 8839 7397 7335 7185 1161 9246 5233 4265 2584 2908 207 4142 1524 7981 5041 7472 5512 3476 5066 9565 1390 7817 872 3037 1115 7064 4750 8934 3138 3226 5815 5483 5029 9115 5843 3533 8988 9569 6966 72 2825 7996 968 2895 4996 7391 3224 3026 219 3389 7355 612 9537 2754 4350 47...

result:

ok OK (n = 10000, m = 200000)

Test #26:

score: 0
Accepted
time: 181ms
memory: 7296kb

input:

10000 200000 8
250 3672
9839 5668
7301 2079
8067 6342
9 4975
9607 2066
9155 1811
9941 3432
8551 629
4925 9987
5919 2483
1940 3439
5 8111
4342 3490
3374 7638
4223 2166
2363 6459
9739 743
1402 4217
6997 4834
4819 1666
9929 4646
6536 3713
3806 7080
7079 7011
5063 5627
2022 6762
1269 8085
1309 3380
5929...

output:

5846 1831 1504 508 695 3171 678 6660 2799 9535 3817 2304 5232 5344 3638 2183 2297 7008 2830 5421 369 1787 1003 8917 7010 5033 8747 2327 1070 6567 9293 1868 8404 674 6375 5935 4395 6152 1258 6226 970 753 6545 3784 1248 4921 3735 6606 5110 593 5106 5359 7688 2544 145 3994 7130 74 25 3187 5097 1203 333...

result:

ok OK (n = 10000, m = 200000)

Test #27:

score: 0
Accepted
time: 185ms
memory: 7360kb

input:

10000 200000 8
3302 6417
9413 9399
3313 4131
786 2293
9139 9699
8443 4561
9691 5227
464 4981
7873 7640
3846 819
4065 1347
1636 278
581 470
1146 6526
6905 220
2531 1990
5091 8710
1122 57
3891 6774
6722 1119
1982 5076
4842 5563
1517 4655
9328 8119
273 6638
6329 6210
6476 8054
2405 1312
1326 703
8278 3...

output:

5846 9760 2646 2095 8554 1464 3630 2185 306 1772 4479 4872 8338 2607 6043 4432 6319 4613 3123 3282 908 5743 9291 7717 1133 739 8837 2985 2743 9108 1190 6863 9994 9238 8779 8843 7298 1713 9010 292 4451 663 8572 970 7965 1433 7606 6168 3317 8263 4226 2633 5873 9409 761 5303 5482 8719 6419 1886 6403 51...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 183ms
memory: 7560kb

input:

10000 200000 8
3084 3869
4018 2306
296 5389
4299 3629
7339 2276
1885 6331
6469 4950
2711 5913
7166 2786
8833 5589
1036 9761
9475 904
7264 2290
6037 5553
8538 3088
5159 1113
9688 3643
3759 1510
4493 9454
1740 6427
8322 5352
357 5133
2320 9267
9060 6912
9835 147
5047 6007
7724 4978
5151 1971
4181 376
...

output:

5846 2360 2366 8790 2726 2339 3364 5836 1691 1781 9608 9123 1100 8380 1237 7137 7730 1217 5197 6973 3770 3989 3763 6121 3736 5492 654 3831 8603 4789 7132 8169 5966 658 7470 9598 6399 9980 6446 4085 4215 7561 3782 2156 3678 4314 6337 2671 238 3330 5602 3040 3094 5838 8957 493 7851 6547 4918 405 8969 ...

result:

ok OK (n = 10000, m = 200000)

Test #29:

score: 0
Accepted
time: 222ms
memory: 7292kb

input:

10000 200000 8
9597 6028
3656 4390
8250 5855
8607 352
4611 2706
9934 7374
9486 979
6681 6227
6429 6067
9887 4297
6831 7725
5456 5316
54 3573
9016 570
8272 6242
2109 9535
6155 1258
7653 5102
3208 2257
2051 757
3836 2495
6474 3355
8945 7549
3001 3458
5766 7537
1216 5016
5767 7532
9508 62
9873 2398
673...

output:

5846 2536 9756 6179 2843 113 3106 7209 5898 4902 5537 2129 9980 5697 3530 2617 6599 4622 4608 705 7380 2973 5678 1471 1801 4464 7811 7991 3654 4335 6529 332 1525 175 9375 3668 8128 9461 8506 6838 2691 1235 5476 4202 862 5358 5531 792 9412 3967 3973 4784 1534 6492 3434 7619 8804 7828 7844 2053 8366 4...

result:

ok OK (n = 10000, m = 200000)

Test #30:

score: 0
Accepted
time: 211ms
memory: 7272kb

input:

10000 200000 8
2841 2895
8325 5650
7175 5527
3709 2461
954 989
2590 7692
8743 3316
2375 5924
5663 7482
7008 6944
1452 5240
9580 3515
8952 4318
82 1578
6108 9683
3380 7256
4492 1555
2801 833
37 5183
7656 4109
8526 6505
3193 228
1390 9500
1152 7758
8065 8808
4837 3239
605 5717
5475 5585
8403 6770
2849...

output:

5846 8379 5477 7714 8910 7094 7621 1007 2851 6617 7821 5076 5220 5978 2233 298 5375 2192 3385 6073 4860 3473 9567 5034 2421 8054 2020 8205 4235 814 5171 9285 9450 5466 1036 25 9317 5599 2497 5685 9895 7816 7742 3855 3333 2157 1535 2787 8452 7640 9934 2237 385 3975 4740 212 9516 9982 6361 4560 8956 2...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 259ms
memory: 7292kb

input:

10000 200000 8
2816 4469
8026 6086
7071 4407
9605 9956
6368 7125
9853 7284
4241 1959
9793 5004
4867 7032
196 3530
4897 2305
1847 5501
3957 4526
9236 8577
2046 3410
8972 4276
4699 4534
9206 8703
4979 8232
8553 6484
2391 7381
513 5754
9656 5122
3511 9811
6734 3960
5908 674
2236 9534
3053 8540
9771 349...

output:

5846 7356 2633 7565 5961 9528 9286 6001 4260 421 4848 2697 4068 287 7937 8268 456 1049 593 3503 7252 6322 9795 1795 4989 5663 2049 5851 9780 7794 3226 284 3251 3881 9415 5597 6096 7697 3436 7754 2055 8907 2218 8116 3459 9932 7567 164 6782 5712 652 1001 3754 6446 444 9247 4440 6239 8702 7391 859 8098...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed