QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#433497#8787. Unusual Caseucup-team008#AC ✓1728ms6920kbC++175.2kb2024-06-08 11:50:082024-06-08 11:50:10

Judging History

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

  • [2024-06-08 11:50:10]
  • 评测
  • 测评结果:AC
  • 用时:1728ms
  • 内存:6920kb
  • [2024-06-08 11:50:08]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
#define f first
#define s second
#define derr if(0) cerr
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << flush;
// END NO SAD

template<class Fun>
class y_combinator_result {
  Fun fun_;
public:
  template<class T>
  explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}

  template<class ...Args>
  decltype(auto) operator()(Args &&...args) {
    return fun_(std::ref(*this), std::forward<Args>(args)...);
  }
};

template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}

template<class T>
bool updmin(T& a, T b) {
  if(b < a) {
    a = b;
    return true;
  }
  return false;
}
template<class T>
bool updmax(T& a, T b) {
  if(b > a) {
    a = b;
    return true;
  }
  return false;
}
typedef int64_t ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef array<array<int, 2>, 2> matrix;

mt19937 g1(0x14004);
int get_random_int(int a, int b) {
  return uniform_int_distribution<int>(a, b)(g1);
}

void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> edges(n+1);
  while(m--) {
    int a, b;
    cin >> a >> b;
    edges[a].pb(b);
    edges[b].pb(a);
  }
  vector<int> ord(n);
  iota(all(ord), 1);
  sort(all(ord), [&](auto a, auto b) -> bool {
    return sz(edges[a]) < sz(edges[b]);
  });
  vector<vector<int>> ans;
  while(sz(ans) < k) {
    vector<int> curr;
    vector<bool> seen(n+1);
    curr.pb(get_random_int(1, n));
    seen[curr.back()] = true;
    int iter = 0;
    while(sz(curr) < n && iter++ < 500*n) {
      int cv = curr.back();
      vector<int> neighbors;
      bool found = false;
      while(sz(neighbors) < min(7, sz(edges[cv]))) {
        int neigh = edges[cv][get_random_int(0, sz(edges[cv]) - 1)];
        if(!seen[neigh]) {
          seen[neigh] = true;
          curr.pb(neigh);
          found = true;
          break;
        }
        neighbors.pb(neigh);
      }
      if(found) continue;
      int idx = sz(curr)-1;
      while(true) {
        for(int a: neighbors) {
          if(curr[idx] == a) {
            found = true;
            break;
          }
        }
        if(found) break;
        idx--;
      }
      reverse(curr.begin() + idx + 1, curr.end());
    }
    if(sz(curr) == n) {
      ans.pb(curr);
      for(int i = 0; i+1 < n; i++) {
        int a = curr[i];
        int b = curr[i+1];
        for(int x = 0; x < sz(edges[a]); x++) {
          if(edges[a][x] == b) {
            if(x != sz(edges[a])-1) {
              swap(edges[a][x], edges[a].back());
            }
            edges[a].pop_back();
            break;
          }
        }
        for(int x = 0; x < sz(edges[b]); x++) {
          if(edges[b][x] == a) {
            if(x != sz(edges[b])-1) {
              swap(edges[b][x], edges[b].back());
            }
            edges[b].pop_back();
            break;
          }
        }
      }
    }
  }
  for(int i = 0; i < k; i++) {
    for(int a = 0; a < n; a++) cout << ans[i][a] << " \n"[a == n-1];
  }
}

// what would chika do
// are there edge cases (N=1?)
// are array sizes proper (scaled by proper constant, for example 2* for koosaga tree)
// integer overflow?
// DS reset properly between test cases
// are you doing geometry in floating points
// are you not using modint when you should

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 3 2 5
1 3 5 4 2

result:

ok OK (n = 5, m = 9)

Test #2:

score: 0
Accepted
time: 1147ms
memory: 6704kb

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:

829 6813 2300 7409 9952 2400 4713 4020 3423 9212 6024 2501 7106 8474 7287 9154 5233 255 9090 4905 5251 1751 3001 8609 6416 1128 5683 5633 8621 3877 9015 2670 1864 7552 551 4920 8992 1506 8904 8173 5933 8285 2339 3930 7847 8599 2876 3498 4690 2040 8961 3109 9965 8617 5087 8950 3218 3964 414 1670 3409...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 1093ms
memory: 6792kb

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:

829 6471 9034 1084 4168 3918 9668 7290 75 2885 5117 9161 3688 3718 4258 164 5878 9399 2537 9239 7546 3336 2575 873 6287 8689 7157 3478 610 4936 8420 1635 9613 6271 7604 9095 7477 5527 9082 1321 4644 7662 702 6160 6208 9193 6882 3570 2778 1019 8685 5119 9472 4212 7623 1986 5604 9150 343 7859 1043 155...

result:

ok OK (n = 10000, m = 200000)

Test #4:

score: 0
Accepted
time: 972ms
memory: 6888kb

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:

829 2398 9042 7940 6379 3414 5871 1182 9855 2921 9335 2221 2815 2645 1196 2600 9735 3013 2293 5762 8186 6864 2362 5077 5676 8081 1191 5356 9282 993 908 1120 5467 2238 4879 187 2406 1827 2862 6217 5064 6139 8061 4146 8344 8399 1647 4555 5985 3866 1390 1968 4007 9141 2227 5537 9158 9628 8134 2480 7248...

result:

ok OK (n = 10000, m = 200000)

Test #5:

score: 0
Accepted
time: 931ms
memory: 6860kb

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:

829 4923 540 7608 4201 9295 4432 8479 8896 2822 8696 4166 2278 2115 9825 4729 8151 2940 8295 4291 1410 7656 8810 3665 6463 2816 8307 221 1036 2049 4496 3954 6631 1844 5045 812 858 3210 8207 4486 2738 2788 3026 3364 749 8985 9382 6907 3017 3713 8892 1379 7617 6593 7059 5995 6413 286 5364 7772 5195 96...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 1728ms
memory: 6760kb

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:

829 8106 3160 6853 1920 3283 8062 7538 1985 4819 8367 7598 2848 6231 573 8527 4478 4722 309 4558 8 1486 2270 3347 2403 4374 7446 6094 3804 549 3487 9443 2129 9523 5668 6348 911 2857 9711 837 701 2247 7666 4610 1249 3243 8157 3793 5938 6877 9107 6605 8282 6735 4576 5225 7850 4125 4211 430 3713 1293 2...

result:

ok OK (n = 10000, m = 200000)

Test #7:

score: 0
Accepted
time: 933ms
memory: 6736kb

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:

829 1212 8668 5010 7281 6153 3718 6361 9953 9136 5924 3455 1119 5103 3988 8122 3915 7731 1924 8318 2451 6599 7347 5369 9218 1047 4941 2599 7144 5116 6838 9243 2230 19 3782 8991 9877 4395 8405 2901 9526 2665 5650 584 4394 2445 7937 2863 904 3454 2448 9173 3703 6197 296 7785 1486 5938 8707 9590 7405 9...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 998ms
memory: 6744kb

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:

829 5148 1508 7194 6184 6613 7451 1422 6547 457 3848 6711 8204 5765 3747 9167 4693 4939 5214 3936 2608 3665 7944 7909 5116 6493 4419 2855 1986 6790 1019 63 7806 2891 8293 3713 985 3903 7197 236 1583 3262 9767 7282 597 8750 2447 6769 2759 5671 6015 7176 2094 5243 4794 7554 3931 4024 4039 4791 8296 54...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 1191ms
memory: 6780kb

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:

829 9751 8793 3210 4376 5921 8097 383 8862 6069 4708 47 5384 8945 9439 3601 4206 9066 5467 212 4232 5664 7034 3123 7955 9762 9672 8596 8691 1420 228 905 3632 5450 7391 3988 1009 4640 6091 839 5255 5093 2005 579 6279 7163 2998 2161 8030 5791 325 2540 4772 6836 9374 5135 1537 3092 7662 4270 7099 2774 ...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 859ms
memory: 6868kb

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:

829 8224 8469 598 6075 4004 2816 318 5394 4312 9560 7552 8905 1560 7060 208 7455 2199 4093 8009 8436 5109 8162 3038 8429 858 6803 9329 8596 9425 9499 7623 1415 1859 2767 6801 9281 9024 5430 2996 3319 4459 3741 3951 4729 9574 3509 4527 9108 7155 7190 2350 8472 8758 6140 1862 3364 6443 7395 9458 7351 ...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 869ms
memory: 6832kb

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:

829 58 4051 5914 2692 2090 7394 2965 8696 8527 979 5583 1805 2184 2653 7528 9838 7793 3052 3418 4355 5862 2530 7510 9866 1806 8322 9158 4248 6762 1414 6404 9216 6198 9841 7987 6489 4234 1633 5908 3685 9933 5190 2874 4748 3986 8930 4297 9937 6200 3787 3146 4510 9872 7686 9192 4167 8435 9268 3391 8825...

result:

ok OK (n = 10000, m = 200000)

Test #12:

score: 0
Accepted
time: 881ms
memory: 6796kb

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:

829 7253 3330 5167 2076 2491 6262 6445 1470 4493 4858 8685 9227 4531 9226 1700 2633 1350 9097 2822 9487 3998 5718 6716 3662 916 6438 580 8730 6630 712 3769 2762 9541 1565 7554 7925 3117 9281 7233 8192 8039 9733 3418 2426 2758 5937 6697 1046 9490 3389 4074 9189 7380 2949 2240 8145 6479 6361 8665 8110...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 978ms
memory: 6908kb

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:

829 5815 145 7963 2312 8985 3966 3823 4350 6906 7230 2324 7347 1476 2576 1793 787 3667 7104 9366 4505 3198 4261 3157 844 9147 9361 1087 9364 4168 5481 8263 2289 1758 3099 7394 1821 8045 1441 9795 8146 5362 1218 1316 8324 7268 3925 84 3643 9021 5792 7214 5622 5217 792 7245 4037 2518 8115 6544 2641 63...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 962ms
memory: 6920kb

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:

829 4239 1578 260 6071 9287 5873 632 2650 5250 1016 4599 9902 3771 7875 7713 4202 4450 1784 4923 1935 5016 8843 2257 6300 9244 9395 7823 360 5820 812 8241 6195 9759 448 4381 3312 2648 4301 5474 7372 3683 6712 8512 3931 6067 7391 890 9598 8561 1874 953 5497 4013 8160 2719 5594 527 2166 3494 9365 9280...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 1086ms
memory: 6796kb

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:

829 3011 9982 1266 4061 651 8604 1484 1121 9968 4302 1625 7290 918 8718 7481 924 959 7043 7843 9447 6333 9865 1857 8825 3897 1974 495 7576 6512 9741 5902 2029 9861 8707 9080 4120 8990 1284 654 1523 8893 1488 9106 2001 8382 7846 3865 9807 7265 5207 8839 774 7138 5927 7392 7921 3750 4260 261 489 6671 ...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 1139ms
memory: 6760kb

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:

829 8129 6692 4454 2481 2823 1663 1248 7072 1296 9554 2061 4492 3975 4468 4076 2457 5079 3641 2347 7555 224 535 7103 3796 9010 3227 1547 4509 8174 3943 3881 8287 7352 3172 3071 1494 7200 5094 1396 568 9727 361 315 5784 8027 8648 4439 9103 7610 3356 1731 2533 1068 6902 794 849 2954 2640 2436 7048 890...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 1042ms
memory: 6712kb

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:

829 9359 8658 3066 1964 8028 3463 3773 1098 1178 7847 496 9345 3091 6019 7012 895 4681 3379 1265 7253 8752 1541 5861 9157 2572 1440 4124 7040 221 1002 1742 544 8088 5638 4473 9672 2405 2682 174 8985 921 5698 2395 4633 8538 6848 6668 6836 636 6659 2069 9720 6793 2697 7224 1831 6309 746 8199 7541 262 ...

result:

ok OK (n = 10000, m = 200000)

Test #18:

score: 0
Accepted
time: 1005ms
memory: 6768kb

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:

829 1990 133 4402 8956 2470 9902 3380 4610 404 1680 2316 4435 8719 4001 2746 6277 9752 3637 8979 394 2791 546 2066 5895 8165 9696 3901 9978 4035 9900 8435 4143 3559 8031 7714 2765 6378 4854 569 6408 1952 353 624 7533 6815 4239 8968 5364 4710 577 519 899 8825 275 7211 3630 3788 9542 2674 2866 1608 94...

result:

ok OK (n = 10000, m = 200000)

Test #19:

score: 0
Accepted
time: 822ms
memory: 6704kb

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:

829 9887 33 3934 191 8611 8089 6680 4509 9244 4066 6738 9160 7114 740 3109 7382 4690 8788 843 6604 4541 2550 4708 3207 6957 3324 9971 7693 8547 305 2283 4335 9216 6829 2143 9766 5199 6810 5206 6365 7520 4603 3505 7318 4942 4226 5991 3123 3696 5643 301 6499 6537 5877 445 4832 2199 3354 444 209 5738 1...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 1014ms
memory: 6728kb

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:

829 16 7133 2405 9980 1911 859 6953 9356 8069 9658 8622 5498 5933 7609 6026 8400 2281 209 7868 7247 2700 9268 8248 6252 6980 6868 6780 2946 9414 431 7729 1202 8945 8563 191 3191 2251 4244 5643 7908 112 6821 4690 8806 385 2936 6225 7020 3260 913 3223 3040 3039 4335 168 2536 7799 6687 592 9410 6679 41...

result:

ok OK (n = 10000, m = 200000)

Test #21:

score: 0
Accepted
time: 921ms
memory: 6740kb

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:

829 2609 489 1635 7371 9094 9881 5035 9613 220 1006 7288 7181 7318 2627 282 8362 9493 9005 2282 4519 9751 6923 571 4324 3323 8895 2401 4211 5956 2525 1414 1953 1474 4582 8405 7944 4660 4147 8519 2700 8994 9270 9014 9710 7567 506 4269 8722 1065 7837 9744 9418 4145 3662 7189 8792 3136 6904 8067 5096 7...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 1125ms
memory: 6860kb

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:

829 2985 3281 7577 4639 8211 9091 8425 2114 9515 9987 419 4351 6887 3779 1649 4483 7316 3615 7588 725 24 2 8404 5012 4432 2273 9766 1682 4020 687 7759 3586 2785 3923 5861 8607 9178 7112 8496 722 8292 7628 470 9070 3457 1260 8693 3711 6276 5870 85 5972 1370 3598 43 8814 4373 3402 6113 4108 6879 9981 ...

result:

ok OK (n = 10000, m = 200000)

Test #23:

score: 0
Accepted
time: 1307ms
memory: 6804kb

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:

829 4896 530 5866 7048 5421 810 2077 6 6340 5174 765 5831 6526 1782 4091 2626 4398 6297 6853 6683 1222 6900 6414 6499 8790 8484 7430 6892 4576 5399 9846 9845 7157 7300 7923 6292 2022 7937 7486 1247 4960 1087 9562 2532 7727 6510 4835 3068 1135 1748 4084 561 3099 9174 3658 9704 468 1537 9155 6687 5590...

result:

ok OK (n = 10000, m = 200000)

Test #24:

score: 0
Accepted
time: 1059ms
memory: 6868kb

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:

829 3239 7781 9051 211 9623 5536 8477 297 2100 9236 7183 1035 1610 7304 6728 4315 6731 3237 2824 8182 1074 5005 8952 1461 4072 9488 4223 9189 7045 7365 901 2774 8786 1451 9681 3312 9453 3691 2665 6840 2041 5804 4503 6912 1901 3836 3958 182 4518 1028 8368 6450 2840 3414 2749 2853 8816 50 4925 7928 12...

result:

ok OK (n = 10000, m = 200000)

Test #25:

score: 0
Accepted
time: 1111ms
memory: 6860kb

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:

829 795 5510 9337 9329 3705 9322 8151 4688 7330 634 7823 874 1850 211 1699 7849 9422 5181 2157 8058 2719 967 8233 6458 7586 532 558 5690 2287 6344 1657 7169 9023 9608 2441 3558 9457 8129 2648 9697 8396 1551 4903 821 7817 246 2336 5934 6361 5307 8366 4348 2086 5950 8754 8747 1286 4576 6098 1149 5035 ...

result:

ok OK (n = 10000, m = 200000)

Test #26:

score: 0
Accepted
time: 986ms
memory: 6704kb

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:

829 2932 6994 7885 2317 6777 5776 6878 476 7356 4788 7044 701 1811 3962 2548 2405 1921 1241 2077 2680 1576 1005 4477 9936 6903 2760 8699 1663 4795 4711 7240 8251 6999 7945 3462 7809 4510 5481 4559 7496 4138 2644 5872 4858 5341 4163 7453 7371 1242 9991 2572 1363 1593 8363 1375 3329 8212 6196 5707 471...

result:

ok OK (n = 10000, m = 200000)

Test #27:

score: 0
Accepted
time: 1130ms
memory: 6728kb

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:

829 8498 3551 4809 8371 4378 8268 9113 21 1543 4524 9332 1337 6477 2896 7829 55 2713 8549 3622 4633 797 2026 2508 4417 1335 1647 9553 2692 3808 9589 2682 7934 1816 9962 4778 5300 4402 2243 4285 8520 4751 5951 7240 3211 47 2677 410 315 1630 5686 5855 5096 8266 1026 6701 2797 2196 2312 7323 4407 4530 ...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 1051ms
memory: 6796kb

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:

829 4351 4531 3874 6321 6910 3122 4872 4402 321 3737 1513 4143 9240 7221 1520 6447 3607 4553 8244 6999 8013 4570 3212 4846 4006 6938 386 9259 1880 1714 9153 9421 8027 2587 6801 7422 3556 5970 6954 9602 7607 246 8646 5711 3076 6133 5399 1632 5760 9996 7762 8161 2405 872 9966 4134 2400 509 4789 223 61...

result:

ok OK (n = 10000, m = 200000)

Test #29:

score: 0
Accepted
time: 957ms
memory: 6724kb

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:

829 1702 5566 4512 3915 6992 8262 943 5761 3797 111 265 3035 8305 7455 3758 9406 4005 6699 7691 8337 2686 9576 2612 6103 1021 6396 941 1225 5765 2161 4911 4827 4139 3388 2632 2337 7854 6147 5247 252 7344 7398 9594 3684 1749 4560 3892 1913 7706 9567 2963 6561 692 1666 9831 3083 7727 3088 7972 8042 70...

result:

ok OK (n = 10000, m = 200000)

Test #30:

score: 0
Accepted
time: 1035ms
memory: 6720kb

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:

829 9267 4961 6098 2751 895 876 6997 4548 5476 8480 4067 6361 9917 3449 5937 2977 4226 9145 5294 5766 8830 9342 6593 6640 5283 1952 8829 7545 6834 1933 2620 886 9761 9007 7852 7012 7237 5976 3537 8021 6335 4456 8193 8897 6157 5910 2332 2151 6530 3864 9666 5228 2957 5754 3893 7670 7363 4326 4965 9391...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 935ms
memory: 6700kb

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:

829 62 9063 7316 3842 2956 5550 7668 2223 8051 9875 6712 5335 3159 9483 361 4121 3831 5896 7875 142 7402 787 9908 7910 3104 3232 8027 2925 2241 4689 7375 8041 2357 8851 5178 1168 8010 4197 4405 3667 1856 9186 8619 2186 1077 7254 5965 9628 8 5487 6964 3265 7932 7840 7410 6614 7553 3941 3978 3945 7251...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed