QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#435262#8787. Unusual Caseucup-team3734#AC ✓1726ms42392kbC++233.2kb2024-06-08 19:28:162024-06-08 19:28:16

Judging History

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

  • [2024-06-08 19:28:16]
  • 评测
  • 测评结果:AC
  • 用时:1726ms
  • 内存:42392kb
  • [2024-06-08 19:28:16]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long i64;
const int inf = 1e9;
typedef double f64;

int n, m, k;
vector< set<int> > graph;
mt19937 rnd(847);

void gen() {
    const int N = 10000;
    const int M = 200'000;
    const int K = 8;
    n = N;
    m = M;
    k = K;
    graph.assign(n, set<int>());
    for (int i = 0; i < m; i++) {
        int a = rnd() % n, b = rnd() % n;
        graph[a].insert(b);
        graph[b].insert(a);
    }
}

bool try_solve() {
    vector<int> path;
    path.reserve(n);
    vector< vector<int> > paths;
    int iter = 0;
    auto start_ts = clock();
    for (int it = 0; it < k; it++) {
        for (;;) {
            path.clear();
            vector<int> in(n, 0);
            int s = rnd() % n;
            path.push_back(s);
            in[s] = 1;

            while (path.size() < n) {
                if (++iter % 1000 == 0) {
                    auto cur_ts = clock();
                    if (cur_ts - start_ts > CLOCKS_PER_SEC / 2) {
                        return false;
                    }
                }

                // for (int x : path) cerr << x << " ";
                // cerr << endl;

                int v = path.back();
                int prev = path.size() >= 2 ? path[path.size() - 2] : -1;
                bool found = false;
                vector<int> tos;
                tos.reserve(graph[v].size());
                for (int to : graph[v]) {
                    if (to != prev) {
                        tos.push_back(to);
                    }
                }
                shuffle(tos.begin(), tos.end(), rnd);
                for (int to : tos) {
                    if (!in[to]) {
                        path.push_back(to);
                        in[to] = 1;
                        found = true;
                        break;
                    }
                }
                if (found) continue;
                if (tos.size() == 0) break;

                int x = tos[rnd() % tos.size()];
                // cerr << "flip " << x << endl;
                auto it = find(path.begin(), path.end(), x);
                assert(it != path.end());
                reverse(it + 1, path.end());
            }
            if (path.size() == n) break;
        }

        paths.push_back(path);
        for (int i = 0; i + 1 < n; ++i) {
            int u = path[i], v = path[i + 1];
            graph[u].erase(v);
            graph[v].erase(u);
        }
    }
    for (auto path : paths) {
        for (int x : path) cout << x + 1 << " ";
        cout << "\n";
    }
    return true;
}

void solve() {
    cin >> n >> m >> k;
    graph.assign(n, set<int>());
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].insert(b);
        graph[b].insert(a);
    }
    // gen();
    for (int jt = 0; jt < 10; ++jt) {
        auto backup = graph;
        if (try_solve()) {
            return;
        }
        graph = backup;
    }

}

signed main() {
    rnd = mt19937(time(0));
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while (t --> 0) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

3 1 4 5 2 
4 2 3 5 1 

result:

ok OK (n = 5, m = 9)

Test #2:

score: 0
Accepted
time: 555ms
memory: 42276kb

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:

6983 7019 1171 6754 6449 2399 2903 8298 3216 8909 6185 3910 7458 1766 6332 2651 575 1709 3904 6281 5504 2115 7380 6076 9261 3550 2758 7302 2746 141 4186 3980 2120 6115 609 4044 164 5045 1307 4327 9 7990 4335 2318 7535 7761 3297 2184 2991 7730 6486 4865 9460 1575 4926 8164 76 6923 6569 5924 3123 4752...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 529ms
memory: 42244kb

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:

5577 3590 8703 4379 2512 1255 7108 6888 3918 3826 3094 8191 4322 1874 6584 4844 3456 4600 1693 7754 5665 3380 5368 2040 5025 1196 6907 6833 1784 8770 4496 8726 7979 1175 7813 5824 7511 4933 4734 5139 5053 321 3998 3919 4618 7265 8083 8500 2472 9969 521 4456 7134 6371 3708 955 7345 5137 8841 3095 455...

result:

ok OK (n = 10000, m = 200000)

Test #4:

score: 0
Accepted
time: 596ms
memory: 42312kb

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:

9110 6903 3082 4952 1494 7969 2727 713 4800 1475 7250 85 3968 7825 8723 4205 9147 4710 931 7126 6668 8144 3908 3149 6499 959 8323 8050 2861 1455 1719 5027 1552 6429 5841 3510 3616 313 8911 6656 7699 3924 9871 4124 1191 756 7664 5484 8928 3493 2170 1235 3363 4068 9966 2518 4935 400 8586 2650 2989 546...

result:

ok OK (n = 10000, m = 200000)

Test #5:

score: 0
Accepted
time: 566ms
memory: 42296kb

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:

4854 5722 6325 9498 5496 7599 3412 3382 128 356 7013 5025 608 563 3975 9979 4271 3288 9206 6134 6091 2080 4969 1981 318 6238 2314 5977 9107 2346 7245 7262 5644 7886 6529 681 1314 7400 2883 824 8071 9906 7994 7653 1075 8392 1479 7361 1883 4591 6678 286 1423 3454 3648 7291 4941 5123 1448 4039 5455 935...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 1726ms
memory: 42264kb

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:

9890 3335 5558 9056 1354 4398 94 4003 2773 2900 3029 6947 7149 2813 3707 9162 2310 4948 1393 8216 9436 5059 2130 2239 4273 9166 7869 3545 3787 6564 3295 4077 3250 4774 655 8233 8358 8920 1828 7072 8755 3577 524 4011 6523 4608 8158 5603 2760 3047 9388 8175 1313 2654 2247 2245 3157 9894 7562 4209 1372...

result:

ok OK (n = 10000, m = 200000)

Test #7:

score: 0
Accepted
time: 581ms
memory: 42272kb

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:

5578 4300 1576 7747 4590 9118 1558 1242 6063 3227 7794 5648 8240 6437 9501 2807 1460 3038 6064 4220 428 3302 4502 9561 5624 5347 9524 8807 9924 1629 6965 5154 9934 6476 3243 4694 4693 2000 1722 5784 2903 9374 1612 560 5330 6998 5948 1806 9223 4724 4722 7856 5562 4640 4305 9938 521 1537 4747 2588 849...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 1210ms
memory: 42328kb

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:

3385 6702 46 6566 6924 3510 2275 2213 8906 4423 139 4508 8131 8233 2274 7964 8850 9982 9917 2426 9136 3993 9792 1872 9023 167 8327 5934 9022 8038 5891 4418 935 2925 3411 1677 4915 2433 691 4299 5112 5674 6605 1517 1843 8016 2840 3066 2214 9841 8004 775 9289 6375 1698 5551 4996 3738 6837 2438 466 960...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 657ms
memory: 42308kb

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:

5619 4146 6796 4525 9894 7178 5146 5438 9871 5307 7883 8257 4963 2433 6107 8295 7171 9346 8068 5551 6227 3874 1421 7871 1046 3815 4689 5441 6437 5399 6760 4996 7079 3002 6295 9471 9137 5173 7598 3604 6944 7944 9888 4775 3969 5215 3977 4516 633 3634 7610 760 968 3420 3200 7293 4536 1789 4555 7742 240...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 613ms
memory: 42220kb

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:

2999 9684 6961 5191 9435 2362 8177 6729 6508 5635 3852 1851 4798 2809 7280 8292 1030 750 3302 5550 5971 3907 5673 4435 5276 6825 5615 1418 168 823 9783 1998 2184 811 3620 4306 2399 9245 1185 9246 4283 6813 4487 9873 5663 4764 8615 7322 9166 2750 1125 9779 7238 4861 6096 5234 7864 2356 4001 2924 9421...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 605ms
memory: 42336kb

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:

1176 9440 8997 3716 8711 3437 616 4062 1636 8881 7031 5169 4042 1806 1995 1935 994 3004 5816 7397 6212 7211 8790 8820 7644 8131 4431 8622 3537 6701 765 8192 8458 3441 8677 5861 3455 4159 9079 6721 9173 6308 1522 1689 9242 2515 3897 5420 9447 9092 7503 3107 3756 2214 7224 7817 2074 2165 2408 2972 847...

result:

ok OK (n = 10000, m = 200000)

Test #12:

score: 0
Accepted
time: 600ms
memory: 42196kb

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:

8730 7366 2123 1464 2099 362 6326 8461 9491 7190 1686 1483 1597 9782 6054 1328 6911 8254 818 6396 3776 4992 2724 736 2353 3486 7556 5963 492 4617 8634 3233 2223 8570 3712 8732 8557 9522 9962 7990 8662 6172 7591 4212 1285 5282 6976 6303 1860 7001 3433 718 4116 2096 842 8005 2936 7213 6239 8577 1282 6...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 631ms
memory: 42340kb

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:

8900 6030 4025 5821 2143 4122 57 7282 6866 6252 8757 9772 4104 7847 3595 9919 7709 8150 9961 628 5999 7354 113 2175 3493 9172 3067 5285 2612 8501 7582 5849 5335 5737 2450 7456 6510 6820 5126 9466 9672 5580 5113 6134 6034 8485 6088 4837 1090 6806 231 6944 4465 585 5064 440 6586 404 3560 7667 1607 337...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 595ms
memory: 42368kb

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:

2518 5212 649 7133 6125 8437 2123 5324 8497 4779 6841 7606 2942 563 3224 5655 8719 218 6813 3201 9806 7371 3278 6339 7627 524 6161 8622 2496 5754 8289 7022 8391 2073 1316 7100 4151 3051 1157 6105 2099 9073 6060 4200 7541 5676 3046 4405 6590 5286 404 1671 2172 4322 4070 5169 1337 7179 6412 8835 2302 ...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 584ms
memory: 42264kb

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:

7022 5023 68 9817 7091 4329 3214 7483 9887 4578 67 4531 5027 6413 9777 8039 734 514 8975 6399 2506 3099 7384 1117 573 6182 654 2242 8780 9632 4866 8962 8661 9962 4733 1267 5451 8484 119 8198 1964 3509 1858 1775 9038 4659 7903 1058 2688 6405 2459 566 476 8452 1029 9347 1303 9647 7323 5261 6409 1127 9...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 635ms
memory: 42244kb

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:

5874 3154 2203 7622 1745 4131 6114 453 6538 249 9687 2378 3597 345 2934 986 8102 4984 6785 3225 8827 7466 5023 6110 9588 2524 771 4103 3425 3522 4097 2449 6381 3137 4577 5599 4857 7049 4845 4058 9122 3108 945 6513 834 5849 485 2888 7068 7340 9851 262 9298 2668 4157 3676 2796 1828 8262 52 7722 8720 2...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 601ms
memory: 42312kb

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:

2847 3623 4129 8018 1989 4949 2052 7719 5450 732 2958 7948 9472 4100 7194 5471 1557 2073 9254 3836 5137 7852 4068 4583 452 4323 8303 6663 2604 472 6040 1401 7608 2685 5153 3065 1952 4865 5307 9700 869 7804 9271 9426 2861 1230 599 3075 5496 672 3347 4832 9052 7512 4185 7827 1499 8372 9484 2395 2019 4...

result:

ok OK (n = 10000, m = 200000)

Test #18:

score: 0
Accepted
time: 605ms
memory: 42376kb

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:

8448 4857 9697 9387 8978 6478 1404 6101 3536 1954 7816 8079 658 6169 8221 5358 7896 1583 7364 9291 8011 2825 5290 8694 839 2967 450 1686 5692 9507 177 2204 1009 6385 2355 9806 801 1572 5255 7126 3527 935 3975 3637 4530 1271 1139 2498 1937 2870 2185 8853 3028 5871 797 2519 8799 5560 2596 8670 2589 26...

result:

ok OK (n = 10000, m = 200000)

Test #19:

score: 0
Accepted
time: 643ms
memory: 42224kb

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:

8196 1918 1425 7022 7619 263 5460 8746 94 7129 5545 4490 8587 4754 3709 7458 9235 3701 9462 5097 8641 2822 1475 8970 2468 6418 6586 4442 9814 5252 5007 521 1934 7003 4136 4841 8984 8326 8520 8090 2447 4512 5496 323 706 2380 2824 7971 8760 9616 2535 5137 8176 8345 821 7820 3938 7151 7295 1893 8977 74...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 634ms
memory: 42252kb

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:

3422 2732 3127 8365 5256 2606 457 8289 9713 9260 896 7075 106 70 6399 5432 3158 9029 9588 2284 3525 1508 3805 532 8799 340 8468 6082 894 9225 9193 1588 2411 9801 8182 9601 51 4929 5752 1879 8497 1560 8832 8122 1543 8203 4085 9939 1036 413 6058 7754 7401 7872 2748 5745 2380 5985 9116 1175 8117 1469 5...

result:

ok OK (n = 10000, m = 200000)

Test #21:

score: 0
Accepted
time: 630ms
memory: 42200kb

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:

6271 4459 6921 8243 9430 1925 5519 8727 2492 8526 1907 7255 5441 2072 1284 6910 7288 5023 5184 7906 2488 2021 2328 9612 3134 4021 9293 4928 7180 1095 317 5827 3110 6701 2232 235 17 1404 823 3679 3716 6151 459 3950 5147 6553 1045 3200 813 7240 1709 3548 9517 2585 5272 1891 8148 8942 9956 2520 7134 31...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 663ms
memory: 42212kb

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:

7247 3913 307 253 136 6651 1373 5612 847 140 9397 1449 7773 9393 9843 5601 6347 1419 2288 7315 1333 1407 3355 8004 429 8297 6926 7435 3768 4604 1003 8908 2325 233 6557 7416 6612 562 2989 4858 9627 3819 339 4648 1472 5937 5771 1279 5028 2215 4429 8290 3783 1716 42 7013 8941 933 9177 1377 9255 5709 55...

result:

ok OK (n = 10000, m = 200000)

Test #23:

score: 0
Accepted
time: 631ms
memory: 42224kb

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:

28 2618 6414 25 9626 8435 8267 9574 4656 1284 3315 9496 2203 1148 7836 8659 6087 5233 9077 6493 1606 9635 7697 7304 1239 4964 1707 2729 4970 4819 6286 4564 7166 3685 9434 4681 8371 9212 6494 7921 8286 1738 7614 3255 9244 6218 9272 568 7184 8863 6529 4682 4492 9356 4731 5975 6448 578 7357 4533 5730 9...

result:

ok OK (n = 10000, m = 200000)

Test #24:

score: 0
Accepted
time: 633ms
memory: 42296kb

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:

9754 6556 5377 3830 9002 391 4365 88 474 6841 2246 491 8251 6118 4374 5919 2778 1236 8006 1523 7933 1602 5117 1625 3222 5543 8523 9872 320 2353 8899 6549 3327 4992 57 5226 5679 1674 9932 653 9462 2121 1020 8282 6305 8549 9910 1508 841 48 2999 1891 1688 706 4285 6560 7670 8566 3658 8315 5152 1148 468...

result:

ok OK (n = 10000, m = 200000)

Test #25:

score: 0
Accepted
time: 618ms
memory: 42336kb

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:

7292 6529 5260 9622 9672 3219 2525 6833 74 8460 2318 2887 7098 3383 4054 9109 7071 1250 6775 1255 195 4512 5411 5220 7699 8160 6190 3944 7270 9322 5251 8239 1723 3060 2056 9378 5750 609 9922 1642 1056 4311 2273 5195 5160 3109 5542 7387 1914 2940 9823 7503 3733 666 3584 6433 3116 5045 6780 7254 2773 ...

result:

ok OK (n = 10000, m = 200000)

Test #26:

score: 0
Accepted
time: 586ms
memory: 42308kb

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:

3843 2895 4615 9319 4544 719 7810 5307 4936 4195 2869 1065 4475 3674 5285 7383 3872 3805 8632 6432 8063 9338 8042 4219 52 2020 1189 3608 9980 5366 5292 9210 6990 7976 3159 1909 6894 261 7173 7960 9870 4932 3251 6096 4316 4032 6441 3134 2605 6335 6228 7081 7901 4555 708 1857 6163 5523 1961 3770 181 1...

result:

ok OK (n = 10000, m = 200000)

Test #27:

score: 0
Accepted
time: 670ms
memory: 42376kb

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:

6896 3723 725 6784 976 8827 4610 5904 5925 7448 4410 909 2942 4732 6684 4326 1615 3641 9879 8357 8274 1594 2236 6674 3312 8475 6567 5608 9192 6543 2603 5433 2216 7962 8618 7065 4256 7881 8450 1278 2860 8589 4213 7983 1158 2888 5657 8687 7262 307 8366 8034 8696 2300 5532 4188 5949 6177 8068 1370 4129...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 630ms
memory: 42392kb

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:

2791 4956 4400 4316 4816 2054 2447 9174 4015 3303 8557 2262 5497 7854 4945 6346 4374 4959 5509 6208 6575 8991 5147 7810 8855 6452 730 9897 3280 6980 3166 9398 3486 4057 5930 1764 1573 6195 340 6552 4091 294 9145 590 7888 4258 4737 1747 1257 954 5097 4107 1489 5715 6840 7511 7698 308 122 7429 6668 68...

result:

ok OK (n = 10000, m = 200000)

Test #29:

score: 0
Accepted
time: 640ms
memory: 42308kb

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:

4039 4848 828 9825 7645 1174 9936 9432 7141 230 331 6924 6869 6047 1690 3054 3951 5343 4317 6139 1286 1912 9378 7922 1231 9111 5146 911 8493 2121 940 1708 2736 6575 6508 8232 5676 6173 6605 295 8986 4024 6154 5104 1187 7214 202 1618 3270 3435 6387 6545 720 5364 5834 6078 5835 4345 2431 9404 6568 520...

result:

ok OK (n = 10000, m = 200000)

Test #30:

score: 0
Accepted
time: 597ms
memory: 42268kb

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:

8551 77 1850 727 2515 4132 4304 1605 9449 7519 4967 8481 2582 7366 8341 4747 2588 7643 9888 5273 2041 3708 5135 8849 4260 601 5699 9328 5358 6633 4049 5385 1008 863 9729 1486 2673 229 1614 8630 5661 9860 3682 4881 3348 7581 9008 1424 6619 2904 2797 1906 9357 3269 4956 5085 4262 4684 22 2539 91 3119 ...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 622ms
memory: 42308kb

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:

6740 9907 2154 1739 2914 633 5653 4169 9125 4038 5385 3448 7779 1837 6560 8436 3590 5518 4433 6323 7264 988 6195 4211 7798 1407 704 4561 8853 2112 7632 6382 3175 2746 7590 448 6406 6753 404 8219 6631 703 6878 5253 3396 2245 558 3865 1951 3603 2420 1842 9421 7266 8472 8235 5479 5582 2276 2718 536 481...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed