QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#433527#8787. Unusual Caseucup-team3646#AC ✓257ms8428kbC++173.7kb2024-06-08 12:19:512024-06-08 12:19:52

Judging History

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

  • [2024-06-08 12:19:52]
  • 评测
  • 测评结果:AC
  • 用时:257ms
  • 内存:8428kb
  • [2024-06-08 12:19:51]
  • 提交

answer

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

#define ll long long
#define elif else if
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>


#define repname(a, b, c, d, e, ...) e
#define rep(...)                    repname(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
#define rep0(x)                     for (int rep_counter = 0; rep_counter < (x); ++rep_counter)
#define rep1(i, x)                  for (int i = 0; i < (x); ++i)
#define rep2(i, l, r)               for (int i = (l); i < (r); ++i)
#define rep3(i, l, r, c)            for (int i = (l); i < (r); i += (c))





struct ScalarInput {
    template<class T>
    operator T(){
        T ret;
        cin >> ret;
        return ret;
    }
};
struct VectorInput {
    size_t n;
    VectorInput(size_t n): n(n) {}
    template<class T>
    operator vector<T>(){
        vector<T> ret(n);
        for(T &x : ret) cin >> x;
        return ret;
    }
};
ScalarInput input(){ return ScalarInput(); }
VectorInput input(size_t n){ return VectorInput(n); }

template<typename T>
void print(vector<T> a){
  for(int i=0;i<a.size();i++){
    cout<<a[i]<<" \n"[i+1==a.size()];
  }
}

template<class T>
void print(T x){
    cout << x << '\n';
}
 
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){
  cout << head << ' ';
  print(forward<Tail>(tail)...);
}

mt19937 engine(42);

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

  int N, M, K; cin >> N >> M >> K;
  vector<vector<int>> graph(N);
  for (int i = 0; i < M; ++i)
  {
    int a, b; cin >> a >> b;
    a--, b--;
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
  }

  vector<vector<int>> res(K);
  for (int k = 0; k < K; ++k)
  {
    //  cerr << k << endl;

    int s = 0, mn = 100;
    for (int i = 0; i < N; ++i)
    {
      if (mn > (int)graph[i].size()) s = i, mn = graph[i].size();
    }
    res[k] = {s};

    vector<bool> seen(N, false);
    seen[s] = 1;
    int now = s;

    /*
    vector<int> ord_cnt(30,0);
    rep(v,N){
      ord_cnt[min(29,(int)graph[v].size())]++;
    }
    */
    
    while (int(res[k].size()) < N)
    {
      shuffle(graph[now].begin(), graph[now].end(), engine);
      int nxt = -1;
      for (auto u : graph[now])
      {
        if (!seen[u])
        {
          nxt = u;
          break;
        }
      }
      if (nxt != -1)
      {
        res[k].emplace_back(nxt);
        seen[nxt] = true;
        now = nxt;
        // cerr << res[k].size() << endl;
      }
      else
      {
        assert(graph[now].size());
        nxt = graph[now][0];
        int idx = -1;
        for (int i = 0; i < res[k].size(); ++i)
        {
          if (res[k][i] == nxt) idx = i;
        }
        reverse(res[k].begin() + idx + 1, res[k].end());
        now = res[k].back();
      }
    }
    // cerr << k << endl;

    vector<vector<int>> ngraph = graph;
    for (int i = 0; i < N - 1; ++i)
    {
      int a = res[k][i], b = res[k][i+1];
      int idx = -1;
      for (int j = 0; j < graph[a].size(); ++j)
      {
        if (graph[a][j] == b) idx = j;
      }
      assert(idx != -1);
      graph[a].erase(graph[a].begin() + idx);

      idx = -1;
      for (int j = 0; j < graph[b].size(); ++j)
      {
        if (graph[b][j] == a) idx = j;
      }
      assert(idx != -1);
      graph[b].erase(graph[b].begin() + idx);
    }

    // if (k == 1) break;
  }

  for (int k = 0; k < K; ++k)
  {
    assert((int)res[k].size() == N);
    for (int i = 0; i < N; ++i)
    {
      cout << res[k][i] + 1 << " \n"[i+1 == N];
    }
  }
  

  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1 4 2 5 3
2 3 4 5 1

result:

ok OK (n = 5, m = 9)

Test #2:

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

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:

2912 1161 9084 5977 4269 423 9048 8553 6947 6808 397 4089 2396 5809 541 2133 208 4654 2593 1064 956 3541 2762 2448 6763 3293 259 9185 7800 8696 5862 8757 8508 4440 7209 4620 1898 4077 2143 9477 3222 25 7963 942 8426 7885 6542 7861 2980 4541 1353 795 5198 9654 3642 4005 7322 8496 1394 5792 1376 426 5...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 187ms
memory: 8092kb

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:

5373 6800 9028 4646 5681 7356 853 2348 4405 5268 4518 6513 6974 7394 2168 814 5024 8508 158 9010 4086 1797 246 3944 2211 8937 2717 2342 3936 9414 8869 9626 8309 9623 2040 5025 1196 1438 9796 7627 6888 6056 6697 612 4095 3060 6135 2144 6085 5738 5331 9099 4455 715 8493 5940 5628 4170 2354 1757 8774 4...

result:

ok OK (n = 10000, m = 200000)

Test #4:

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

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:

4633 7833 3740 8639 4283 803 1740 7114 7362 7318 6301 6007 7317 5566 2183 3803 4582 1033 4677 1890 4681 4122 6168 7835 4693 4076 4175 9152 1261 6773 3451 6841 3563 9782 7406 7579 1436 713 9012 3477 5240 636 5598 3783 5613 1137 8069 9915 8732 579 4254 5526 705 6685 1446 8783 7706 8905 9461 2079 5396 ...

result:

ok OK (n = 10000, m = 200000)

Test #5:

score: 0
Accepted
time: 213ms
memory: 8116kb

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:

6968 6740 8094 9029 4527 4631 2836 9071 4319 4573 9991 8206 6443 1722 2347 4466 14 611 4416 2024 1663 9016 4951 78 7950 7499 8242 2523 8873 5962 9312 1641 7207 2356 7865 6138 3759 51 4245 5133 2403 5231 6499 3202 7840 5439 4495 3753 9943 8196 8890 9967 2671 114 1275 1615 4248 8301 3421 7599 1841 715...

result:

ok OK (n = 10000, m = 200000)

Test #6:

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

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:

5827 2621 1053 4285 4196 9653 2185 8058 1669 8918 3476 4222 6763 4208 5637 2141 7720 1043 3887 4449 1615 9265 5307 1463 3434 8868 5229 6417 4621 1122 7529 8943 486 7926 9401 9697 6723 4635 2222 6018 8154 8975 8033 337 9311 2171 8747 5273 1288 2051 6606 6906 2930 5702 4531 9206 7798 8910 3575 3758 37...

result:

ok OK (n = 10000, m = 200000)

Test #7:

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

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:

265 8791 2086 7324 8249 511 42 5329 6532 8609 6535 7120 9710 5493 8820 3212 5312 508 6837 7546 2334 2732 7112 646 3308 4284 6469 9866 6793 658 1567 8200 2099 453 3443 8621 3222 932 6405 3931 9611 9687 402 9193 604 4699 2522 783 4547 8127 1148 5173 7762 1097 7469 1860 6502 728 8370 5055 9934 2659 660...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 205ms
memory: 8176kb

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:

1638 318 5084 7786 6742 8804 7628 256 3697 6353 1602 9452 7739 4426 5873 7828 1902 3982 5850 9682 6072 9541 4467 686 398 4764 9752 6594 2140 91 6626 7721 3123 569 4771 3884 553 5298 8604 9157 6255 4452 7683 5907 5225 8881 2441 3880 8737 9939 5184 3040 2411 6366 3557 9261 4853 3971 7865 6035 5631 400...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 199ms
memory: 7964kb

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:

1545 7907 2451 7435 3622 3862 866 2255 878 7534 7448 7450 5021 8495 3680 884 1953 2415 7958 2801 6158 3204 6323 6153 519 7990 5143 3818 2900 6835 9552 1081 1491 234 7542 1998 8154 6405 6085 442 9674 1067 6981 882 3326 421 5237 4039 1858 346 5041 1455 2192 5554 3687 7911 4017 6369 9044 4197 6005 6360...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 192ms
memory: 7944kb

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:

4689 9352 9308 4535 8837 7668 6745 6780 1292 8640 8287 8886 9823 1031 6173 870 7793 99 4937 5305 5585 3294 4429 1768 7031 4527 1654 3958 4456 7238 4158 9109 6500 655 8978 4953 9653 8306 2475 5924 7747 2471 8302 6719 4669 6911 1377 5356 8944 3788 4797 7918 493 8822 1462 4859 5964 6769 9722 8340 7396 ...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 180ms
memory: 8180kb

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:

4802 3049 3365 297 8658 2677 2693 781 698 4579 4374 7640 7194 5931 3042 5776 8482 5202 9983 683 7787 4447 327 112 1106 461 8125 7297 6596 8465 5635 8756 5613 3684 6748 2359 183 6984 2640 7006 1356 3471 3126 5166 8295 7574 8218 5787 7211 8578 3353 8141 5600 6065 6711 3623 8144 6961 7586 5955 7452 392...

result:

ok OK (n = 10000, m = 200000)

Test #12:

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

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:

3394 4947 3254 7905 5092 6617 7112 3440 1914 8088 6664 7503 673 1118 2280 8060 8214 8855 3124 3724 8828 1618 9420 6866 2814 4471 8892 837 7339 1388 6934 6621 6606 35 8353 7232 2277 6665 907 2755 3478 6333 1581 7974 7466 2646 3499 7376 1277 605 5332 830 8994 6232 2199 1174 4895 1595 7013 5928 2721 32...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 189ms
memory: 7820kb

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:

4622 1131 4352 8296 7827 4262 8608 9677 7585 7561 3414 2400 8734 7364 379 2073 6325 5663 6550 1442 815 1265 4300 9426 6119 488 2047 8929 3522 6864 9242 3411 1574 5505 6456 9286 9311 1701 6343 2053 9072 3729 3971 2521 6804 7897 8840 4551 4671 5184 6443 4765 1796 7379 6352 4479 8653 8897 5817 6493 547...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 204ms
memory: 8188kb

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:

7425 2879 2263 7345 8110 8216 6008 8080 1705 8422 1157 6627 117 9137 1210 322 6201 9283 7959 9345 4306 6630 5986 3689 3625 5098 1124 4289 4516 1568 5109 9381 2392 6804 2677 3158 5945 7397 1898 7322 6213 6828 7750 8938 7055 4499 7559 5072 764 8726 3267 7077 1090 389 3116 3885 8449 6711 3169 7929 5057...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 189ms
memory: 7840kb

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:

5864 2858 285 4140 4057 9672 5910 634 8701 7556 84 8586 5513 6224 2414 1025 9944 7849 9335 979 4022 9271 5616 267 515 8173 7462 8651 8294 1668 851 6375 2953 7832 4142 3156 1724 6608 6248 3189 1544 9353 4147 1686 5515 722 4306 1426 9246 9635 3052 2903 5117 2338 8158 7392 6045 5175 307 8813 5244 5523 ...

result:

ok OK (n = 10000, m = 200000)

Test #16:

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

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:

2125 693 9215 571 710 903 9252 115 3997 9478 1459 6312 9333 2000 5883 5684 8049 254 9704 6522 4134 3197 1941 1737 2278 3360 3353 791 1057 1510 8353 455 8863 3321 4161 6226 1486 966 6603 666 1279 3292 813 7234 4891 471 979 5718 2455 4591 3185 9858 3710 122 5539 1551 6496 3081 432 2865 2269 7106 3761 ...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 204ms
memory: 8088kb

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:

5524 4040 4743 3761 6763 846 4388 4311 166 1040 7946 50 3469 2744 5239 8849 9534 2654 2182 7238 7776 8106 9707 5822 4886 5866 4706 3622 793 3098 7586 1364 8419 4613 4679 2964 6125 9686 8495 6556 4205 979 804 2288 3161 8074 5962 6758 1190 7536 1079 3678 1742 6063 2365 2497 9879 7274 1831 78 4398 2091...

result:

ok OK (n = 10000, m = 200000)

Test #18:

score: 0
Accepted
time: 257ms
memory: 8124kb

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:

131 7936 6892 1153 2772 9928 1891 9876 9216 9495 6495 1253 7216 1689 8921 6431 6328 5815 7812 4813 9756 7118 886 6774 9294 2207 7121 1707 3085 7432 8769 907 2442 2366 3604 6642 6379 4064 7027 4885 8863 2461 2840 2310 8969 3692 7303 6045 2866 1391 3415 5646 6905 8509 240 1629 2644 5297 1709 9669 9329...

result:

ok OK (n = 10000, m = 200000)

Test #19:

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

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:

6302 5223 8622 2883 7065 7022 4888 9367 8007 8699 4040 1133 649 6594 8593 8411 9780 2225 2241 3178 8871 8632 4920 9433 7659 3037 5614 8906 137 4124 298 4660 3419 7088 5026 9858 3889 8194 564 9539 9908 5787 3823 672 5349 5657 2792 7844 6674 6570 1753 7864 732 2114 3918 1572 3840 8608 5972 6652 1432 1...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 187ms
memory: 8052kb

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:

6237 973 2079 9681 1313 8963 9671 1515 6161 6606 3560 4390 2148 9852 1247 8247 3613 2786 8553 7901 8740 7283 2227 2181 8650 9064 9270 5306 790 1301 7460 4360 5753 4829 1760 9990 4882 3493 470 7181 8841 2155 3814 6947 3792 7419 8421 128 2481 5553 3628 6346 7865 7523 1102 7992 4257 162 8601 8349 8719 ...

result:

ok OK (n = 10000, m = 200000)

Test #21:

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

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:

9320 745 6847 7278 5541 9920 8083 2188 3942 3810 1446 792 1204 975 7213 7316 2529 7490 9933 609 7581 5717 5526 8681 5274 9239 8469 4444 9968 237 6683 3899 2009 9255 2756 6690 3492 5508 9738 6114 2618 6161 9773 4219 1864 6717 4119 4657 862 1227 7510 3037 2711 3466 6881 224 7991 8660 379 259 3635 2998...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 195ms
memory: 7804kb

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:

5604 1008 6658 8081 2357 4403 1837 4920 7592 1606 7596 207 9741 5857 2588 7254 8693 3930 5713 5052 8725 2626 4910 438 4628 5574 2670 6046 2219 6348 6149 1062 8650 2517 7910 1717 5636 4434 7171 9912 7795 7042 4111 979 9500 908 664 7778 3227 1807 273 1510 7791 1619 2841 5026 982 3913 3048 2806 378 481...

result:

ok OK (n = 10000, m = 200000)

Test #23:

score: 0
Accepted
time: 176ms
memory: 8428kb

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:

6276 8110 8259 6876 1286 7849 6114 250 6398 608 2404 9956 1355 6607 3226 8693 6490 9839 836 1655 8131 8332 7209 5155 3492 1250 9984 6178 7077 8740 7851 6066 7235 3846 242 6751 910 3963 5130 8884 4616 8592 267 3561 1394 8573 1207 2137 5694 4189 5546 6503 969 9003 1968 1959 166 3172 6262 9059 4486 229...

result:

ok OK (n = 10000, m = 200000)

Test #24:

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

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:

822 4503 1059 9665 7457 9439 8087 7690 6175 8085 4859 5041 7898 1175 6401 3493 2895 4587 7975 7746 4051 5076 8333 3835 6837 4643 9789 3800 9967 6569 8731 7700 1964 6465 2742 7687 6730 8754 2629 9373 973 8404 3987 9140 2215 2540 1755 6087 8555 1924 3620 905 5394 7607 7798 4293 7603 9171 4103 2891 576...

result:

ok OK (n = 10000, m = 200000)

Test #25:

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

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:

593 3625 6877 5328 2977 1428 1492 4162 8731 9019 5220 9227 3978 8853 5905 9689 5123 5945 7648 9334 7703 2618 2041 4814 6687 4389 8147 1457 9366 9265 4025 7025 6986 1955 6809 9102 4979 6223 668 40 2084 6471 6458 98 8630 7042 2744 3697 3347 4752 6462 5035 5728 5145 2145 8894 4196 3643 4729 6564 9962 8...

result:

ok OK (n = 10000, m = 200000)

Test #26:

score: 0
Accepted
time: 180ms
memory: 8160kb

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:

2158 6886 3152 4362 432 4752 2857 1165 3801 310 7435 9091 6411 2219 7319 3288 3134 301 832 31 2191 8272 5293 3192 2187 4815 2282 4565 2735 4784 1888 128 805 791 9099 5870 8897 9961 4709 2258 1567 583 790 1907 4442 449 9678 764 3513 754 2658 6438 5398 4305 1164 2939 3931 3345 2326 7113 4795 6531 6820...

result:

ok OK (n = 10000, m = 200000)

Test #27:

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

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:

3490 3894 1790 4696 7093 7323 1440 3631 2669 427 2432 5905 4423 69 5789 2213 9726 1220 6953 3054 8661 7134 8958 3143 1082 7748 7835 949 2350 1705 6263 8671 9667 2359 7639 6670 4959 279 9312 6362 7113 7939 8319 1226 1598 6305 5631 3166 5539 4000 4932 6339 4274 5953 2093 7334 793 6399 5108 4608 93 370...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 188ms
memory: 8128kb

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:

3299 7319 5607 4916 7434 3806 5249 446 4646 7186 8677 3988 851 6524 2568 6588 2417 580 9390 7817 5817 6995 2869 1861 9870 3575 4923 5078 543 3726 1082 9631 9637 3485 1632 1660 6667 9163 6179 6758 4910 1912 9371 2816 1341 7784 2930 8688 1740 6633 1039 1819 5023 3842 8080 9347 5997 7732 4434 7246 6816...

result:

ok OK (n = 10000, m = 200000)

Test #29:

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

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:

2531 8734 9691 4373 8180 1580 9603 3553 2579 3878 1678 3935 1196 5958 683 3158 5274 1177 7 9770 5317 8294 2960 6288 4358 1308 5164 947 9209 8173 4041 8428 4398 1294 1236 450 2818 8816 8325 6684 6823 1042 7706 2056 7851 4350 430 7142 6237 9155 3568 7563 2898 9335 1065 3051 5209 2833 8067 3531 2510 83...

result:

ok OK (n = 10000, m = 200000)

Test #30:

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

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:

1231 840 9273 2337 3074 8047 9984 5298 5 8123 6169 394 4559 9250 692 4318 5990 4675 5385 3036 3083 3821 6600 9484 9740 6464 1400 8690 3655 5195 9194 262 5926 4244 6775 4462 4291 6244 8021 1229 7496 2120 4949 2693 682 5785 2902 1615 135 3948 8083 8779 3267 7796 3874 3346 5108 4165 2980 8489 2207 8662...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 204ms
memory: 7732kb

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:

3134 997 3998 2081 5968 5910 5801 5110 2425 8179 6571 3141 3594 2215 7618 5020 8464 698 2976 8943 181 5974 9430 6966 4167 7810 8221 2812 8521 7191 8607 8242 8288 5174 1724 9576 6620 8597 1809 8069 2828 2238 2218 2079 5696 8213 3289 352 2132 5352 3106 8317 5296 7299 3798 3806 2369 9192 4166 1862 7836...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed