QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#676281#8787. Unusual Caseucup-team5062#AC ✓198ms13548kbC++173.4kb2024-10-25 20:55:102024-10-25 20:55:11

Judging History

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

  • [2024-10-25 20:55:11]
  • 评测
  • 测评结果:AC
  • 用时:198ms
  • 内存:13548kb
  • [2024-10-25 20:55:10]
  • 提交

answer

#include <set>
#include <cmath>
#include <vector>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <algorithm>
using namespace std;

string to_string(const vector<int>& arr) {
	string res = "[";
	for (int i = 0; i < int(arr.size()); i++) {
		if (i != 0) {
			res += ", ";
		}
		res += to_string(arr[i]);
	}
	res += "]";
	return res;
}

uint64_t seed = 123456789;
uint64_t xorshift64() {
	seed ^= seed >> 13;
	seed ^= seed << 7;
	seed ^= seed >> 17;
	return seed;
}

int rand_int(int l, int r) {
	return l + int(xorshift64() % (r - l));
}

struct edge {
	int s, t;
};

vector<int> solve(int N, int M, const vector<edge>& es) {
	vector<vector<int> > g(N);
	vector<int> d(N);
	for (int i = 0; i < M; i++) {
		g[es[i].s].push_back(es[i].t);
		g[es[i].t].push_back(es[i].s);
		d[es[i].s]++;
		d[es[i].t]++;
	}
	vector<int> start_choice = { 0 };
	for (int i = 1; i < N; i++) {
		if (d[i] < d[start_choice[0]]) {
			start_choice = { i };
		} else if (d[i] == d[start_choice[0]]) {
			start_choice.push_back(i);
		}
	}
	vector<int> p;
	while (true) {
		int start = start_choice[rand_int(0, start_choice.size())];
		p = { start };
		vector<int> idx(N, -1);
		idx[start] = 0;
		uint64_t loops = 0;
		while (int(p.size()) != N && loops < 100000) {
			loops++;
			vector<int> choice;
			for (int i : g[p.back()]) {
				if (idx[i] == -1) {
					choice.push_back(i);
				}
			}
			if (!choice.empty()) {
				int z = choice[rand_int(0, choice.size())];
				p.push_back(z);
				idx[z] = int(p.size()) - 1;
			} else {
				int t = g[p.back()][rand_int(0, g[p.back()].size())];
				int l = idx[t] + 1;
				reverse(p.begin() + l, p.end());
				for (int i = l; i < int(p.size()); i++) {
					idx[p[i]] = i;
				}
			}
		}
		if (int(p.size()) == N) {
			break;
		}
	}
	return p;
}

vector<vector<int> > solve(int N, int M, int K, const vector<edge>& es) {
	vector<edge> cur_es = es;
	vector<vector<int> > ans(K);
	for (int t = 0; t < K; t++) {
		vector<int> p = solve(N, cur_es.size(), cur_es);
		ans[t] = p;
		vector<int> ip(N, -1);
		for (int i = 0; i < N; i++) {
			ip[p[i]] = i;
		}
		vector<edge> next_es;
		for (edge e : cur_es) {
			if (abs(ip[e.s] - ip[e.t]) != 1) {
				next_es.push_back(e);
			}
		}
		cur_es = next_es;
	}
	return ans;
}

vector<vector<int> > random_solve(int N, int M, int K) {
	set<pair<int, int> > s;
	vector<edge> es;
	for (int i = 0; i < M; i++) {
		int a, b;
		do {
			a = rand_int(0, N);
			b = rand_int(0, N);
		} while (a >= b || s.find(make_pair(a, b)) != s.end());
		s.insert(make_pair(a, b));
		es.push_back(edge{a, b});
	}
	vector<int> d(N);
	for (edge e : es) {
		d[e.s]++;
		d[e.t]++;
	}
	cerr << "mindegree = " << *min_element(d.begin(), d.end()) << endl;
	vector<vector<int> > ans = solve(N, M, K, es);
	return ans;
}

int main() {
	/*
	for (int t = 1; t <= 100; t++) {
		int u = clock();
		random_solve(10000, 200000, 8);
		cout << "t = " << t << ": " << clock() - u << endl;
	}
	return 0;
	*/
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int N, M, K;
	cin >> N >> M >> K;
	vector<edge> es(M);
	for (int i = 0; i < M; i++) {
		cin >> es[i].s >> es[i].t;
		es[i].s--;
		es[i].t--;
	}
	vector<vector<int> > ans = solve(N, M, K, es);
	for (int i = 0; i < K; i++) {
		for (int j = 0; j < N; j++) {
			if (j != 0) {
				cout << ' ';
			}
			cout << ans[i][j] + 1;
		}
		cout << endl;
	}
	return 0;
}

详细

Test #1:

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

input:

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

output:

2 3 5 4 1
3 4 2 5 1

result:

ok OK (n = 5, m = 9)

Test #2:

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

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 3464 1684 1672 8573 1014 5959 3953 4382 2065 4961 9428 199 3337 615 7970 7472 7540 4962 1008 7806 2192 6629 6855 7563 8855 7826 1700 1707 7556 533 1557 9802 94 4950 9274 7564 8381 3293 1748 3970 7118 1547 1018 3153 6548 7560 1040 345 8322 2692 3045 5512 646 6986 1934 5513 3149 4743 1469 8161 86...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 175ms
memory: 12784kb

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:

9447 8267 115 739 6395 6280 9212 7717 9638 403 4157 2934 5061 8952 8959 9313 8040 7048 1533 9041 3553 6456 6803 577 1240 3822 5259 3027 6120 42 8892 2573 6764 8389 1050 7746 9570 3013 6812 663 62 1729 9639 8094 5984 9925 3582 345 4343 5110 5114 9141 9279 5059 7912 4755 7768 558 515 6512 1740 6572 62...

result:

ok OK (n = 10000, m = 200000)

Test #4:

score: 0
Accepted
time: 177ms
memory: 13148kb

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:

9086 6305 1837 1524 2762 1536 8270 4295 7665 5531 372 2334 3783 4664 4834 4827 7195 3858 2764 8626 2146 6782 5497 4006 4894 3085 573 7444 6166 3639 794 6726 1608 6539 1055 1647 282 4329 6054 5122 5273 4123 5408 3294 594 683 4338 9294 85 1197 2075 8918 7821 1642 656 5185 7526 217 5249 7023 7477 5792 ...

result:

ok OK (n = 10000, m = 200000)

Test #5:

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

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:

8699 1793 4810 5086 5665 5943 5485 9856 6780 5025 9823 7367 5434 281 5323 8499 4407 1501 8958 596 9722 5779 8564 4878 732 9968 6706 5970 2035 7048 7038 1367 9946 4288 1186 5205 8642 8133 6876 5695 9002 86 1924 9573 7557 721 9170 947 698 1582 8043 4205 2252 5937 1534 5840 2515 24 9850 3137 6914 8431 ...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 196ms
memory: 12956kb

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 5465 9176 2455 1704 7426 3723 1475 3595 9966 8843 9423 6817 1095 9337 5986 4202 4494 757 540 493 1112 499 1120 8936 7550 5546 7105 8741 1654 3340 8467 5060 6780 1886 3471 2726 3486 3089 4261 3727 7976 4838 7997 5488 3734 2881 9954 9561 2799 1888 2845 7989 8268 3052 7177 6581 1781 9066 4828 4478...

result:

ok OK (n = 10000, m = 200000)

Test #7:

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

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 4568 1746 2281 3203 2811 5511 3767 710 6905 6411 7690 7552 6551 56 2894 5937 9873 5639 4171 7927 7886 8116 5236 3056 4293 3749 4539 8371 3399 6765 2449 5509 4123 5158 2651 3511 8024 6402 4654 488 9057 6623 7073 2200 6493 3533 7288 8133 6689 6913 4441 133 2793 1624 8514 2369 6338 9485 3093 9937 3...

result:

ok OK (n = 10000, m = 200000)

Test #8:

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

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 1370 7316 7073 9185 612 7957 8006 7137 494 6289 9037 2359 3514 5792 2663 1146 4914 6775 845 3769 2269 9253 927 9701 7777 6794 4960 6003 59 5773 7788 8677 6619 2205 3640 3193 7415 8157 7704 3698 7997 7546 7734 382 1266 7184 4435 6338 9363 3388 1280 4922 5285 7712 8705 9970 8264 5962 2420 3817 30...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 178ms
memory: 13088kb

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 1722 111 8977 758 385 3485 8888 5655 1926 4505 2310 9582 9480 3523 8120 9799 3514 4473 9186 1689 2453 9668 6281 4318 1732 2474 8688 568 9687 6405 8128 2970 7337 6062 5290 972 3021 7566 3692 8839 1490 4434 889 7605 964 9079 4581 7111 1374 8368 167 7445 6918 1165 789 8730 9964 5496 2802 5510 8924...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 179ms
memory: 13088kb

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:

8417 7565 1447 1453 3370 4749 2141 1365 8951 2312 2988 5721 9787 6741 9057 6395 9280 7237 6904 9823 4723 9680 2781 3934 206 6412 7325 3942 5826 7368 6734 4653 2238 511 5983 3187 8076 5318 2953 8116 7569 2498 9432 8928 6430 4305 2742 6532 8992 5122 9792 533 3883 4345 4296 4162 8267 1178 2391 1812 832...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 191ms
memory: 13140kb

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:

7643 7206 2825 7433 5167 6009 4459 7947 7495 7054 1235 2565 7984 9403 7090 1039 8089 2157 9726 1038 163 1789 9847 9625 3924 4429 6854 1009 4003 8139 8426 3942 2870 9401 7247 4803 1322 3611 3116 9892 7872 4624 3317 3215 5467 5838 4485 3081 4634 5159 7161 5794 8275 8284 9812 7677 3773 3384 2672 3053 9...

result:

ok OK (n = 10000, m = 200000)

Test #12:

score: 0
Accepted
time: 170ms
memory: 13212kb

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 9536 5124 1004 3467 9411 4372 9269 2382 9857 3839 5110 5255 6561 7164 6950 5198 7505 2903 4998 179 3014 8437 9544 9631 2998 1012 9069 8530 8659 3038 8904 9649 5113 9930 4620 6880 1949 8815 1943 9704 1837 9681 1793 6474 8473 9236 7380 481 7932 9158 4876 3396 2349 7185 9647 3773 1258 9886 9047 16...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 182ms
memory: 13096kb

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 1 9116 9715 7281 8119 8306 3309 2329 2457 4744 5644 2935 9632 5195 1366 7134 2379 1318 3287 2218 280 6687 8020 4653 7410 6566 6702 9149 7025 6930 4288 8100 7981 5591 1005 773 3522 4456 4706 9693 5814 3328 3452 2491 6782 8377 3246 6401 7602 7913 8876 8729 9437 728 1577 3952 9254 4168 8035 6464 2...

result:

ok OK (n = 10000, m = 200000)

Test #14:

score: 0
Accepted
time: 163ms
memory: 12572kb

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 6343 5872 4989 4369 7323 58 6320 7734 1005 9880 6448 8863 5959 1123 4806 2819 7461 9905 6288 5885 1002 2992 9943 4157 7196 9767 9489 6124 2958 1137 7974 447 5068 9005 6617 9493 2941 3460 6431 9316 3900 6216 9797 4447 9318 5667 7068 6248 2745 2557 3827 1004 456 8505 5745 4383 2947 2720 9889 604 ...

result:

ok OK (n = 10000, m = 200000)

Test #15:

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

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 9839 3171 9463 2929 2895 9808 1818 7060 6840 4181 9259 8973 5505 6463 623 2184 8248 7746 4075 6167 7648 4647 2796 738 681 1005 3594 8121 6607 7311 6258 1810 428 8237 166 6780 2088 7235 2634 6490 3846 6716 9055 5530 8552 7586 2116 9373 6056 2386 7917 2379 1936 8148 3795 3662 5178 1993 3411 4129 ...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 166ms
memory: 12568kb

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 3553 2919 4509 4300 412 929 9362 9139 4161 8650 6470 8564 2417 5585 6819 9112 8767 99 6507 596 4913 9192 3778 5313 1801 399 3623 2405 8664 2034 1113 7965 8779 6628 8029 3486 7147 8302 5380 9680 8634 451 2488 4113 8510 9817 8929 2973 5777 9133 3954 4715 4274 538 4769 8319 6615 1578 4054 8398 878...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 179ms
memory: 12564kb

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:

5887 5295 7554 9906 9366 2703 7728 1143 1434 9394 905 31 5086 2483 8305 2704 3416 8814 6657 2160 7495 9159 7198 4727 1003 9522 6479 2882 7330 9499 2649 4781 1381 1435 6296 2461 7359 4818 1660 9698 6547 1732 9331 6425 9978 4696 2268 683 5174 5615 5244 7447 7823 3485 72 1108 1716 7876 721 2305 4937 90...

result:

ok OK (n = 10000, m = 200000)

Test #18:

score: 0
Accepted
time: 166ms
memory: 13160kb

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:

7493 2172 6837 3534 4465 2418 1145 7111 9683 5962 1788 3106 2769 789 8616 4503 9986 2768 3947 2568 2048 9630 3996 3877 3664 2329 1429 7800 2373 8184 85 4365 8712 8899 8786 7210 5479 6417 1046 9898 6132 5589 9791 3997 4213 4355 269 9290 8070 1408 7552 3943 8989 9759 1157 8087 5436 7079 5603 3989 717 ...

result:

ok OK (n = 10000, m = 200000)

Test #19:

score: 0
Accepted
time: 174ms
memory: 13052kb

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:

6567 4911 9535 5154 207 3909 4434 6401 9333 2533 5192 692 8985 733 2315 4845 9505 7982 3076 2856 6853 3368 3017 8851 1390 5476 5398 9463 8219 2013 5295 4801 8967 5081 4574 2574 9839 3638 2605 8272 3127 5717 2707 8220 1254 9326 7179 1930 2969 8545 2855 2804 84 1907 4591 9046 7935 771 6525 9608 1459 4...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 168ms
memory: 13124kb

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 7733 8660 2221 7025 1449 4170 7102 6547 3569 2722 2158 640 5569 220 3619 2048 4070 2556 6187 7087 3546 3969 4300 9034 2879 1925 8994 5192 1281 6239 6120 9411 8536 9132 3342 9692 170 3436 9583 7913 9335 8081 50 4541 8159 9458 9126 6544 7269 4402 1040 3082 6825 514 3645 8753 6551 3503 648 6955 54...

result:

ok OK (n = 10000, m = 200000)

Test #21:

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

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:

9632 2288 341 1879 933 2930 6584 6219 4669 6158 6346 7118 1986 5528 557 4829 3045 9440 5271 2118 8336 3647 8019 728 1954 4429 8525 3033 9110 6666 5853 1136 7774 4769 2238 6941 2384 9654 7515 2427 82 6836 6239 7089 9424 4349 8237 5591 8052 554 1577 2671 7528 6393 6498 4168 4842 2279 135 2754 3410 198...

result:

ok OK (n = 10000, m = 200000)

Test #22:

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

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 998 606 9026 5834 6852 3243 6627 9435 4537 9370 3668 2666 5632 3029 1696 2335 407 6124 3606 8279 9232 3222 1841 7311 3830 2481 235 3225 391 100 3401 7401 9390 1996 9239 6854 3783 8393 2684 519 5174 2690 6354 1457 193 4725 1085 5893 3423 1576 7189 7767 4428 9704 1808 2804 8228 1063 2620 4837 533...

result:

ok OK (n = 10000, m = 200000)

Test #23:

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

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 7730 3929 7055 2764 953 2190 3205 2833 2335 2362 8843 1183 8743 8142 1185 2863 6068 467 5815 4196 5934 8146 7495 5550 1573 8627 3871 9534 1304 1499 9985 7814 2334 8409 371 2778 9234 4698 6424 8092 5126 9770 2828 9221 4012 5582 4172 9794 4597 7611 1127 7175 2387 2492 5897 3976 9567 3432 8774 805...

result:

ok OK (n = 10000, m = 200000)

Test #24:

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

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 5716 5556 8275 3632 6784 6527 4380 2486 2194 5790 1010 9819 5360 2850 39 5198 1339 9005 7006 7789 5553 3699 4851 8444 829 5625 2659 2721 234 2907 6759 8257 4074 4421 2558 4245 1 4552 2884 5335 7146 2267 7580 5538 4368 5242 4640 8521 6516 2281 9135 5161 8449 6507 5004 2889 8279 2408 421 3164 5730...

result:

ok OK (n = 10000, m = 200000)

Test #25:

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

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:

7539 4927 4342 3737 1616 4329 3726 2868 7773 6098 5151 8695 8183 9454 3233 2962 9777 5864 8351 9255 1007 7337 4634 3858 8088 9791 6975 814 7825 9999 9124 3887 2973 6704 9628 1449 8710 3365 9191 5966 8733 7165 5185 9111 5741 8181 4406 3655 6173 5415 8755 8543 5637 8844 1753 2035 9862 4793 8955 6651 5...

result:

ok OK (n = 10000, m = 200000)

Test #26:

score: 0
Accepted
time: 162ms
memory: 12568kb

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:

6800 5977 4407 4074 2429 4268 7287 641 9244 165 5802 5770 4900 1189 2020 5591 7138 3984 27 6359 1499 7608 2884 4520 4450 4475 9850 1297 4109 2784 6332 1474 1854 7587 1308 6879 1214 6461 8453 606 4186 9060 2046 5665 6825 9177 8914 7212 3950 5079 9780 2186 3296 4188 1773 6420 6295 4121 631 2564 1806 7...

result:

ok OK (n = 10000, m = 200000)

Test #27:

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

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 171 7398 7765 1391 6950 1079 3130 23 5777 1252 9506 8265 2645 8757 8382 2263 8642 4679 4556 4308 5808 3645 1114 7856 469 6167 3159 1810 5188 1100 2155 592 1419 9666 4090 3577 2140 8907 3762 2259 330 2906 3170 6983 472 7528 8970 3461 3797 5094 3574 8534 3937 8751 1329 758 2277 3746 8060 6450 977...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 163ms
memory: 12540kb

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:

9403 2945 4153 3311 9710 1353 7191 2693 1099 2742 6763 3486 4066 69 8784 5579 8110 5661 7498 6822 5495 1960 6954 1569 9182 1507 5014 679 6226 4275 329 7683 9884 9045 5455 6071 1777 7839 7788 3793 1096 957 8061 3538 3169 5912 4789 8399 8770 6803 9837 7954 1810 6932 9922 4318 2179 1168 8566 5460 2967 ...

result:

ok OK (n = 10000, m = 200000)

Test #29:

score: 0
Accepted
time: 168ms
memory: 13116kb

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 5733 7357 1843 2661 5465 776 570 7751 1600 2663 3973 8552 1041 9768 766 1873 6709 8367 9382 3359 2542 6259 652 196 1293 4082 1967 3506 1225 1322 9934 7374 2307 9315 4230 6587 2725 9964 954 2654 3442 7491 8510 1539 9164 2001 9728 5363 3955 2243 2827 1668 137 7096 6890 1407 7114 1560 4652 9683 98...

result:

ok OK (n = 10000, m = 200000)

Test #30:

score: 0
Accepted
time: 190ms
memory: 12620kb

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:

7708 7775 9362 1881 1414 9894 1621 4121 6352 412 3821 3083 1397 5707 3460 2772 6243 8699 5969 1561 7038 1544 430 4136 880 2238 4732 6483 4884 370 1656 2840 7469 4907 6346 9021 5793 7230 2551 1988 5867 9763 7352 9628 6096 5305 3782 4747 5706 3388 7733 9220 6316 8525 6002 8264 9179 4314 7231 7969 2685...

result:

ok OK (n = 10000, m = 200000)

Test #31:

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

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 2018 4633 1257 85 942 1010 7610 4116 1240 963 3875 3770 8848 4913 2582 6838 5660 8172 2439 6198 2725 8490 6962 4939 7241 2505 1018 144 2455 2415 9613 5455 2707 8067 2979 3820 7964 8299 532 5855 9506 5965 348 530 4972 1665 2283 8557 4462 3453 5783 4914 4325 8468 9414 5873 1844 878 7558 7937 8436...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed