QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#436373#8787. Unusual Caseucup-team1198#AC ✓716ms8560kbC++203.1kb2024-06-09 00:17:542024-06-09 00:17:55

Judging History

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

  • [2024-06-09 00:17:55]
  • 评测
  • 测评结果:AC
  • 用时:716ms
  • 内存:8560kb
  • [2024-06-09 00:17:54]
  • 提交

answer

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

const int MAXN = 10'100;

vector<int> G[MAXN];

mt19937_64 rnd(228);

double prev_time = 0;

double get_time() {
  return clock() * 1.0 / CLOCKS_PER_SEC;
}

const double MAXTIME = 0.3;

bool is_tl() {
  static int kek = 0;
  ++kek;
  if (kek != 100)
    return false;
  kek = 0;
  double time = get_time();
  if (time - prev_time > MAXTIME)
    return true;
  return false;
}

//#define RANDOM

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);


  int n, m, k;
  cin >> n >> m >> k;

#ifdef RANDOM
for (int _ = 0; _ < 100; ++_) {
  double kek = get_time();
#endif


  vector<pair<int, int>> edges(m);
  for (int i = 0; i < m; ++i) {
    int a, b;
#ifdef RANDOM
    a = rand() % n;
    b = rand() % n;
#else
    cin >> a >> b;
    --a;
    --b;
#endif

    edges[i] = make_pair(a, b);
  }

  while (true) {

    prev_time = get_time();

    for (auto [a, b] : edges) {
      G[a].emplace_back(b);
      G[b].emplace_back(a);
    }
    auto rem_edge = [&](int u, int v) {
      for (int _ = 0; _ < 2; ++_) {
        int j = 0;
        while (G[u][j] != v)
          ++j;
        swap(G[u][j], G[u].back());
        G[u].pop_back();
        swap(u, v);
      }
    };

    vector<vector<int>> paths;
    bool ok = true;

    for (int i = 0; i < k; ++i) {
      vector<int> cur_order;
      int cur = rnd() % n;
      cur_order.emplace_back(cur);
      vector<bool> in_path(n, false);
      in_path[cur] = true;
      while (!is_tl() && cur_order.size() < n) {
        cur = cur_order.back();
        vector<int> opts;
        for (int v : G[cur]) {
          if (!in_path[v])
            opts.emplace_back(v);
        }
        if (opts.empty()) {
          int prev = G[cur][rnd() % G[cur].size()];
          int j = cur_order.size() - 1;
          while (j >= 0 && cur_order[j] != prev)
            --j;
          reverse(cur_order.begin() + j + 1, cur_order.end());
        } else {
          int nxt = opts[rnd() % opts.size()];
          cur_order.emplace_back(nxt);
          in_path[nxt] = true;
        }
      }
      if (cur_order.size() != n) {
        ok = false;
        break;
      }
      for (int i = 0; i + 1 < cur_order.size(); ++i) {
        int v = cur_order[i], u = cur_order[i + 1];
        rem_edge(v, u);
      }
      paths.emplace_back(cur_order);
    }
    if (ok) {
#ifdef RANDOM
      cerr << _ << " ok " << get_time() - kek << '\n';
#else
      for (int i = 0; i < k; ++i) {
        for (int v : paths[i])
          cout << v + 1 << ' ';
        cout << '\n';
      }
#endif
      break;
    }

    for (int i = 0; i < n; ++i)
      G[i].clear();
  }


  for (int i = 0; i < n; ++i)
    G[i].clear();

#ifdef RANDOM
}
#endif
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 278ms
memory: 3632kb

input:

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

output:

3 2 4 5 1 
4 1 3 5 2 

result:

ok OK (n = 5, m = 9)

Test #2:

score: 0
Accepted
time: 155ms
memory: 8420kb

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:

5733 388 1662 971 1393 8590 3735 6681 2853 9800 4945 6254 2903 4158 4327 9 9851 9891 2860 2027 6046 5222 8451 4998 2904 297 3449 8720 9679 1654 9615 24 1422 8361 1385 3002 3950 2415 2651 127 443 8234 3822 1142 1245 8473 5870 1588 3684 7756 9400 2499 5173 2755 1909 6999 7937 8906 4921 67 2478 7704 62...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 155ms
memory: 8340kb

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:

5733 5664 9163 5413 3294 6476 7967 2959 8629 4607 2786 3847 6664 8096 4813 4581 7022 3588 303 5370 2107 1107 5790 4385 5403 6307 2886 7663 9831 5867 8730 4670 5551 2991 4097 5607 1670 4652 8159 3930 5489 1774 7501 1538 7618 1187 889 5317 808 117 6440 2000 2218 5232 9595 3716 3120 7025 4549 1567 5612...

result:

ok OK (n = 10000, m = 200000)

Test #4:

score: 0
Accepted
time: 134ms
memory: 8328kb

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:

5733 6844 8461 917 9700 2033 9310 5339 3265 3048 4430 420 4620 1186 1978 8878 6490 429 658 1115 3910 3506 6017 1931 6922 1661 7269 5372 6336 4057 7618 4616 688 1939 7389 5961 237 2206 9999 1789 3241 4160 7599 1687 1034 2468 2210 9407 2629 9957 8273 636 1545 7681 682 4078 6798 7775 4727 5425 6866 491...

result:

ok OK (n = 10000, m = 200000)

Test #5:

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

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:

5733 2294 2108 3697 9599 4921 9204 4856 5324 1592 6772 6087 6703 5809 2460 9952 7155 1812 837 1781 4299 1715 749 6650 9018 9121 6265 283 9975 7002 2674 5454 2057 1009 8232 6901 2139 1292 7107 8499 7916 5947 4742 4922 1249 822 4959 4969 2080 7331 1475 289 5524 4884 7068 6966 458 4589 128 5855 1780 79...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 716ms
memory: 8436kb

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:

5287 9376 8006 5581 6617 135 1019 5307 2930 2684 3038 2443 909 7466 1694 1145 7963 6849 346 8873 2619 8319 3144 8215 1237 5211 8964 3802 8960 7438 3661 8234 9191 8911 6177 7659 5442 6623 7806 1155 4811 5439 3022 5009 25 5834 3070 635 3129 7052 180 741 7776 1634 8422 1595 9797 9301 4219 8574 8797 221...

result:

ok OK (n = 10000, m = 200000)

Test #7:

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

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:

5733 3117 5972 3277 8823 2528 9995 6290 8671 2425 8029 8878 4842 32 2096 8879 8482 9232 4216 7393 3849 4741 6189 8781 1984 8568 9158 2074 9932 529 9264 7417 9327 3522 46 6498 9662 1769 9444 504 1685 7523 6952 5415 818 6581 8805 4490 5197 7922 5651 8291 6212 6799 3559 7467 8081 5343 9790 7852 6246 24...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 129ms
memory: 8552kb

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:

5733 6303 3864 9413 3534 4095 480 2398 8672 4078 7193 3788 1152 6545 4858 2727 4820 4568 6844 7724 3576 2465 1920 9181 6556 9614 4786 9561 5016 3962 5107 3856 8667 4861 6099 3163 9569 8240 7167 3004 1700 3346 6184 1187 143 5709 782 8063 1834 5689 9627 14 7078 7583 4661 4986 6117 3739 4493 3071 2012 ...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 113ms
memory: 8384kb

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:

5733 4668 79 5478 9329 9402 1978 6462 1125 6403 6063 2165 6082 8405 1230 829 4606 3595 4166 6268 1953 5861 2582 8917 3872 6218 3907 6510 9797 6836 7118 8390 7485 5545 4916 5065 4168 8796 2639 8551 8505 9214 1873 898 7234 6763 761 4440 8525 6327 899 2224 141 3197 9251 7437 4528 9808 1612 2653 526 957...

result:

ok OK (n = 10000, m = 200000)

Test #10:

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

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:

5733 6721 4177 9395 6202 8902 7746 3070 4988 9773 2069 406 3072 1911 5268 1598 664 6298 4302 9021 1129 2569 6755 6488 4345 2754 2659 1895 7075 9200 2438 2543 2732 4607 6353 5881 393 5318 4266 8655 5748 4531 2909 6178 8064 1721 5023 518 3312 6019 9083 6283 3210 471 9631 4766 8416 9651 769 7485 8571 7...

result:

ok OK (n = 10000, m = 200000)

Test #11:

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

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:

5733 2685 2512 2891 5357 6815 5514 2472 9826 861 3150 1586 5066 6730 7335 7902 2091 5585 5196 277 624 3693 4294 4502 262 8243 1861 8303 3599 2198 6507 4068 1672 5694 2796 3196 8492 2370 4977 7702 9239 7866 2605 4243 6445 8674 309 4962 9402 880 2695 2807 3263 5150 6790 5468 1853 3041 5869 6805 3409 7...

result:

ok OK (n = 10000, m = 200000)

Test #12:

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

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:

5733 8822 1212 5465 348 8036 9473 8922 8631 3227 145 47 4945 4321 4263 843 9698 9409 4995 5116 3473 1992 744 4768 2506 9626 4466 5672 7799 3549 7513 1291 7437 816 2185 8271 3260 7185 4085 908 4247 5651 1730 3823 719 9755 6879 7076 9385 6993 286 9526 6280 9975 1479 4473 7890 7343 6371 91 3300 9372 91...

result:

ok OK (n = 10000, m = 200000)

Test #13:

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

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:

5733 3410 7868 4067 742 7206 9658 252 5965 2145 490 7823 5032 408 2804 9147 4713 1026 4324 4910 5667 8651 5214 8193 7921 6318 5363 1839 672 3933 2088 9099 7855 3604 4048 4123 5779 3791 8566 7784 7408 6291 1434 8842 1650 602 1448 3947 7153 4189 9539 8107 3538 4693 7623 3025 6655 4314 9003 9671 4740 1...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 121ms
memory: 8556kb

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:

5733 1325 720 3846 9191 7659 7036 5156 5273 7646 9544 3337 6948 9112 8884 1082 7537 8471 394 8104 4429 3276 9661 4885 946 3897 5015 9576 3373 8232 4695 6709 3840 9695 7136 9770 7211 5526 3126 5416 5527 8270 6099 3772 1447 6456 5734 4152 2171 5430 1235 2237 873 166 7239 7563 951 4135 461 3261 7997 96...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 115ms
memory: 8264kb

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:

5733 9358 334 6190 3401 184 6797 9577 7766 5385 8227 9252 7269 991 8058 9579 3887 2341 8897 8815 6168 683 8816 3176 1029 1233 7590 1767 7086 4831 9531 9264 8107 9135 4972 2122 3828 3427 1484 8604 8497 3741 8555 5031 1499 3829 7839 2445 5764 1092 4064 4777 9550 4160 7934 2356 7426 7899 7765 5708 8164...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 122ms
memory: 8332kb

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:

5733 7855 3795 3966 8864 9374 557 1389 1488 3700 5449 9903 3185 9858 8936 2444 1375 1068 8235 507 119 1801 399 1858 8579 385 2759 9746 6741 6329 8915 3701 1689 268 7972 8977 9994 7056 1211 7788 3221 1218 1371 2641 1466 2585 5310 3727 29 8850 6284 9498 5992 8717 4066 1327 9894 3426 6373 304 5246 424 ...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 114ms
memory: 8276kb

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:

5733 6406 853 5597 4728 3593 9420 7021 2169 9803 6128 3859 121 2586 9142 4100 813 7755 1364 8099 9690 7544 243 5725 8390 435 9703 8655 9566 2675 6842 3791 4068 7774 8928 5768 7013 7649 7926 6022 5593 2062 4498 7757 4991 4699 3035 8830 7303 1763 2364 1520 7116 5141 684 1131 9456 2071 4561 5911 8579 1...

result:

ok OK (n = 10000, m = 200000)

Test #18:

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

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:

5733 6071 4570 3513 5289 7247 7497 6069 3174 1314 8967 9425 9228 776 9940 2345 7638 9592 6605 541 7999 871 664 592 2071 2389 2676 8544 7482 9893 7721 1989 7895 9229 3952 2781 3481 4412 4285 3451 588 6619 7693 3324 4499 6195 3153 1868 8987 4286 2577 1586 5388 4653 1658 9014 6621 2292 374 310 1616 163...

result:

ok OK (n = 10000, m = 200000)

Test #19:

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

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:

5733 6852 3369 6627 5298 4502 55 1501 2850 4171 9077 5460 5945 3367 5040 128 6240 1130 521 1094 9569 8359 7568 1681 5238 6979 6873 5073 1219 550 7930 3079 5050 9152 1903 4008 1435 1198 9373 1533 6729 3153 1792 5668 4958 9934 2655 1067 9697 981 8169 8049 2588 7929 6382 2438 1334 4771 705 9922 983 901...

result:

ok OK (n = 10000, m = 200000)

Test #20:

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

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:

5733 2895 8993 1958 5576 805 621 3682 3223 8907 3135 691 4355 1301 8196 3596 1106 981 6986 4347 7816 1179 3300 3056 6615 9149 1689 7228 5692 4251 2718 2228 9006 1145 4496 899 1766 5042 9458 7724 2795 7778 4487 3805 3126 9582 4271 160 9338 376 701 9287 4627 2285 3870 260 1850 1054 5595 6513 1093 7111...

result:

ok OK (n = 10000, m = 200000)

Test #21:

score: 0
Accepted
time: 132ms
memory: 8328kb

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:

5733 6643 3961 4844 7822 3898 9390 7519 3703 2810 2965 5994 5492 2398 5560 5270 3784 6694 5176 8219 9330 1524 6037 5053 2561 7470 3464 9049 9969 7862 2942 6684 7190 3663 7230 818 327 4782 1372 5113 8200 385 8426 4434 8436 3416 4462 2940 296 1144 1911 9006 8060 1790 1528 2649 8868 9580 5217 5679 5377...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 129ms
memory: 8532kb

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:

5733 9930 7994 5206 2619 2062 9160 1596 5597 5689 9936 1266 1058 7935 4142 254 3699 2400 6012 5097 8657 1467 7443 4968 4655 3280 8893 2453 1977 584 3011 8250 6591 354 1081 2222 2906 1125 6223 3700 8103 7909 3073 3487 2821 8424 5364 8800 8253 9687 3451 4042 5719 2306 2463 3047 8170 7932 5276 2864 646...

result:

ok OK (n = 10000, m = 200000)

Test #23:

score: 0
Accepted
time: 132ms
memory: 8384kb

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:

5733 7468 1355 5836 2797 6499 4147 5549 8923 4267 4674 2020 5196 7920 1785 9951 9276 8946 459 6415 8979 1246 5770 3189 7354 9698 9643 3452 9874 2175 4844 6269 108 1165 5002 1405 3373 8416 7787 7895 7938 9021 4504 9164 5319 7331 4791 135 5938 4672 6530 5651 6636 4260 2482 6609 719 9382 2311 3730 7950...

result:

ok OK (n = 10000, m = 200000)

Test #24:

score: 0
Accepted
time: 679ms
memory: 8308kb

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:

8475 1835 7017 1698 5181 3511 7668 1069 9271 5019 4459 803 7468 4742 6757 1296 9243 5889 98 9291 8927 6163 5493 2911 2069 9404 2853 7161 7473 597 5696 7797 4621 407 193 6825 7582 5139 5811 5285 306 2643 5348 2648 1678 2413 1762 6734 1821 3390 8246 6551 3377 2353 7280 2925 7012 5016 4473 2033 2216 19...

result:

ok OK (n = 10000, m = 200000)

Test #25:

score: 0
Accepted
time: 122ms
memory: 8332kb

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:

5733 9225 6092 3724 7509 3429 9294 316 8700 9696 3502 5204 9093 1908 6944 6926 2483 9026 5493 2295 7225 9916 2147 2051 8114 3466 4490 8299 8073 4261 940 3610 6351 6702 4986 4248 4347 1374 7375 4042 550 7964 2109 6293 1009 8102 7325 9385 7177 8455 4319 2545 8357 4239 7552 6499 6444 5063 5335 9420 833...

result:

ok OK (n = 10000, m = 200000)

Test #26:

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

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:

5733 9428 2026 90 6819 4066 7589 3082 2439 5455 2436 934 1543 8719 3544 3642 3636 1719 4267 6595 8052 2586 7460 3147 181 444 3053 4091 3265 2443 3208 1879 4716 3397 9253 9815 3982 8885 1264 8623 9963 8794 3451 267 5760 2576 3024 2818 7407 5861 3000 9047 1582 4012 2929 2508 8891 9659 8280 3038 6673 9...

result:

ok OK (n = 10000, m = 200000)

Test #27:

score: 0
Accepted
time: 144ms
memory: 8336kb

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:

5733 9952 408 3510 6560 5829 9394 6628 7292 3420 480 2716 3405 4292 9805 9408 151 2600 2624 7750 2994 5993 2254 1505 2410 7974 5286 4477 8171 7429 7458 3617 4450 3162 6434 6461 5840 337 3219 8647 6985 4884 24 4457 3799 7941 2777 8750 3294 6373 2047 8664 1625 4665 72 6203 909 3726 4514 1861 3203 4925...

result:

ok OK (n = 10000, m = 200000)

Test #28:

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

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:

5733 8820 6659 363 3185 6131 1316 5279 4332 5959 9843 5663 9015 3639 7991 4068 3953 3768 5760 2969 8833 2940 442 4841 756 476 8045 547 3611 1452 5924 1693 764 7725 434 2267 6760 3487 2398 9774 3379 7693 4026 4567 6871 8387 9741 8754 9344 7704 3093 7217 2935 1937 8508 8071 4925 4788 63 3395 8062 9424...

result:

ok OK (n = 10000, m = 200000)

Test #29:

score: 0
Accepted
time: 135ms
memory: 8328kb

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:

5733 5996 5894 6900 8457 9464 3590 6191 8589 7835 9838 781 7998 120 7646 9000 7299 5282 4589 3475 375 1396 6935 2183 5835 944 7471 8937 2818 3871 6379 1469 8688 7738 9182 3386 7052 8337 8325 6816 8613 695 6921 7925 1589 6294 9247 5753 6608 8620 3640 7919 2598 7284 1084 7815 4253 8408 1361 6869 6521 ...

result:

ok OK (n = 10000, m = 200000)

Test #30:

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

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:

5733 5249 1127 6373 458 1165 4410 2689 6198 2699 4900 9551 6131 2475 4376 339 205 9595 3363 9481 3606 8611 8900 6671 8637 2938 3472 4478 4896 6012 9007 9913 6495 3118 4741 6807 58 8274 526 9438 2803 9757 9716 154 9940 5752 5047 8861 7087 3834 3899 7903 5416 8444 8 9092 4968 6622 7964 6988 5478 5199 ...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 128ms
memory: 8388kb

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:

5733 3344 5016 7156 22 422 5022 9009 1859 6785 6412 5344 5101 1046 4211 4482 2090 6161 2350 8302 7434 4919 8822 7065 4117 6426 2065 9821 4436 6975 2574 888 2539 809 3038 7468 4353 9559 5601 2957 3832 1438 8215 1577 4725 8285 883 4643 375 8051 8244 3157 1876 5888 8240 7955 4064 3788 2698 4366 2026 85...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed