QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#438761 | #8787. Unusual Case | hos_lyric | AC ✓ | 779ms | 48380kb | C++14 | 8.4kb | 2024-06-11 04:42:19 | 2024-06-11 04:42:19 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
// https://codeforces.com/blog/entry/90743
#include <bits/stdc++.h>
using namespace std;
namespace hamil {
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
#define ll long long
namespace LCT {
vector<vi> ch;
vi fa, rev;
void init(int n) {
ch.resize(n + 1);
fa.resize(n + 1);
rev.resize(n + 1);
for (int i = 0; i <= n; i++)
ch[i].resize(2),
ch[i][0] = ch[i][1] = fa[i] = rev[i] = 0;
}
bool isr(int a)
{
return !(ch[fa[a]][0] == a || ch[fa[a]][1] == a);
}
void pushdown(int a)
{
if(rev[a])
{
rev[ch[a][0]] ^= 1, rev[ch[a][1]] ^= 1;
swap(ch[a][0], ch[a][1]);
rev[a] = 0;
}
}
void push(int a)
{
if(!isr(a)) push(fa[a]);
pushdown(a);
}
void rotate(int a)
{
int f = fa[a], gf = fa[f];
int tp = ch[f][1] == a;
int son = ch[a][tp ^ 1];
if(!isr(f))
ch[gf][ch[gf][1] == f] = a;
fa[a] = gf;
ch[f][tp] = son;
if(son) fa[son] = f;
ch[a][tp ^ 1] = f, fa[f] = a;
}
void splay(int a)
{
push(a);
while(!isr(a))
{
int f = fa[a], gf = fa[f];
if(isr(f)) rotate(a);
else
{
int t1 = ch[gf][1] == f, t2 = ch[f][1] == a;
if(t1 == t2) rotate(f), rotate(a);
else rotate(a), rotate(a);
}
}
}
void access(int a)
{
int pr = a;
splay(a);
ch[a][1] = 0;
while(1)
{
if(!fa[a]) break;
int u = fa[a];
splay(u);
ch[u][1] = a;
a = u;
}
splay(pr);
}
void makeroot(int a)
{
access(a);
rev[a] ^= 1;
}
void link(int a, int b)
{
makeroot(a);
fa[a] = b;
}
void cut(int a, int b)
{
makeroot(a);
access(b);
fa[a] = 0, ch[b][0] = 0;
}
int fdr(int a)
{
access(a);
while(1)
{
pushdown(a);
if (ch[a][0]) a = ch[a][0];
else {
splay(a);
return a;
}
}
}
}
vector<vi> used;
unordered_set<int> caneg;
void cut(int a, int b) {
LCT::cut(a, b);
for (int s = 0; s < 2; s++) {
for (int i = 0; i < used[a].size(); i++)
if (used[a][i] == b) {
used[a].erase(used[a].begin() + i);
break;
}
if (used[a].size() == 1) caneg.insert(a);
swap(a, b);
}
}
void link(int a, int b) {
LCT::link(a, b);
for (int s = 0; s < 2; s++) {
used[a].pb(b);
if (used[a].size() == 2) caneg.erase(a);
swap(a, b);
}
}
vi work(int n, vector<pi> eg, ll mx_ch = -1) {
// mx_ch : max number of adding/replacing default is (n + 100) * (n + 50)
// n : number of vertices. 1-indexed.
// eg: vector<pair<int, int> > storing all the edges.
// return a vector<int> consists of all indices of vertices on the path. return empty list if failed to find one.
LCT::init(n);
if (mx_ch == -1) mx_ch = 1ll * (n + 100) * (n + 50); //default
used.resize(n + 1);
caneg.clear();
for (int i = 1; i <= n; i++) used[i].clear();
vector<vi> edges(n + 1);
for (auto v : eg)
edges[v.fi].pb(v.se),
edges[v.se].pb(v.fi);
for (int i = 1; i <= n; i++)
caneg.insert(i);
mt19937 x(chrono::steady_clock::now().time_since_epoch().count());
int tot = 0;
while (mx_ch >= 0) {
// cout << tot << ' ' << mx_ch << endl;
vector<pi> eg;
for (auto v : caneg)
for (auto s : edges[v])
eg.pb(mp(v, s));
shuffle(eg.begin(), eg.end(), x);
if (eg.size() == 0) break;
for (auto v : eg) {
mx_ch--;
int a = v.fi, b = v.se;
if (used[a].size() < used[b].size()) swap(a, b);
if (used[b].size() >= 2) continue;
if (x() & 1) continue;
if (LCT::fdr(a) == LCT::fdr(b)) continue;
if (used[a].size() < 2 && used[b].size() < 2)
tot++;
if (used[a].size() == 2) {
int p = used[a][x() % 2];
cut(a, p);
}
link(a, b);
}
if (tot == n - 1) {
vi cur;
for (int i = 1; i <= n; i++)
if (used[i].size() <= 1) {
int pl = i, ls = 0;
while (pl) {
cur.pb(pl);
int flag = 0;
for (auto v : used[pl])
if (v != ls) {
ls = pl;
pl = v;
flag = 1;
break;
}
if (!flag) break;
}
break;
}
return cur;
}
}
//failed to find a path
return vi();
}
}
int N, M, K;
vector<pair<int, int>> E;
int main() {
for (; ~scanf("%d%d%d", &N, &M, &K); ) {
E.resize(M);
for (int i = 0; i < M; ++i) {
scanf("%d%d", &E[i].first, &E[i].second);
}
map<pair<int, int>, int> ids;
for (int i = 0; i < M; ++i) {
ids[E[i]] = i;
ids[make_pair(E[i].second, E[i].first)] = i;
}
loop:
vector<int> on(M, 1);
vector<vector<int>> ans(K);
for (int k = 0; k < K; ++k) {
vector<pair<int, int>> es;
for (int i = 0; i < M; ++i) if (on[i]) es.push_back(E[i]);
const auto us = hamil::work(N, es);
// cerr<<"on = "<<on<<", us = "<<us<<endl;
if (us.empty()) goto loop;
for (int j = 0; j < N - 1; ++j) {
const int i = ids[make_pair(us[j], us[j + 1])];
assert(on[i]);
on[i] = 0;
}
ans[k] = us;
}
for (int k = 0; k < K; ++k) {
for (int j = 0; j < N; ++j) {
if (j) printf(" ");
printf("%d", ans[k][j]);
}
puts("");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3804kb
input:
5 9 2 1 3 1 4 1 5 2 3 2 4 2 5 3 5 4 3 5 4
output:
1 3 4 5 2 1 5 3 2 4
result:
ok OK (n = 5, m = 9)
Test #2:
score: 0
Accepted
time: 734ms
memory: 45584kb
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:
4589 333 6729 9742 3753 6760 9564 2872 1112 1188 3608 9705 7497 818 8998 8076 7068 7039 5118 8062 3376 7560 4940 4819 6860 429 5126 243 9855 3335 4216 6641 1420 603 6434 1082 509 8922 111 6616 2490 3317 9566 7718 2100 4459 2098 1925 6688 4362 8676 4400 2170 5539 4144 7190 4959 5006 6638 6516 3398 14...
result:
ok OK (n = 10000, m = 200000)
Test #3:
score: 0
Accepted
time: 740ms
memory: 47876kb
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:
6485 5500 6415 5365 4163 4954 1051 7646 5471 579 9389 5551 3299 4497 6704 9853 1442 1582 5693 6681 8722 3073 4328 9161 2895 6849 363 4533 7832 9918 6362 4282 7673 6618 163 7251 1985 8351 8891 5920 5103 6781 7252 5302 8778 4821 6999 8880 330 3516 8914 9904 3182 490 8270 2720 8883 4084 8468 6420 7306 ...
result:
ok OK (n = 10000, m = 200000)
Test #4:
score: 0
Accepted
time: 707ms
memory: 46552kb
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:
281 4337 9623 1607 5443 291 9569 1547 6263 1989 1215 2125 225 5905 4243 654 6848 5984 2973 3689 9044 707 8587 2954 4468 5432 9145 7973 4438 5451 2280 3679 9296 2300 3508 2829 1729 3117 3763 7842 310 2262 7643 6037 5796 1148 1638 1927 6501 1963 8202 8757 6910 8564 7446 964 1726 8069 6635 3189 5747 60...
result:
ok OK (n = 10000, m = 200000)
Test #5:
score: 0
Accepted
time: 722ms
memory: 47872kb
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:
6767 4757 7212 8296 1227 5806 9115 417 7580 9790 6509 5762 2341 1652 4073 2952 8076 2671 71 4156 3058 3315 4958 5974 7743 5206 9383 1882 1982 4078 8954 8227 3026 2636 9703 8670 6851 1235 7689 7726 1433 5051 5161 7827 9160 1418 7507 3211 8223 1635 2587 6475 1284 3014 8755 5683 125 9673 1523 3423 7815...
result:
ok OK (n = 10000, m = 200000)
Test #6:
score: 0
Accepted
time: 748ms
memory: 47072kb
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:
3479 7166 7658 802 6964 4435 3985 8853 1170 6743 3764 6780 1886 9154 3811 5402 658 8614 8863 8895 1160 2119 5933 224 3608 4860 4704 6925 3825 904 1578 3926 9747 8654 2283 636 2955 3886 8195 2737 6529 410 6067 3318 5444 9768 9618 7273 2548 7945 6481 5345 4306 2448 4249 6463 3702 685 9899 4223 1320 87...
result:
ok OK (n = 10000, m = 200000)
Test #7:
score: 0
Accepted
time: 685ms
memory: 46716kb
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:
387 5629 8440 7825 2580 9166 8389 2510 555 2925 2354 8448 6024 3566 6962 4685 4982 7508 5003 8966 8705 8434 6568 8522 7198 4748 9343 1459 6371 2029 7333 2650 5787 5708 9370 8874 1534 1537 9521 9032 7976 7133 6648 9833 3589 2285 6460 599 1908 5523 5259 2705 7590 6450 8810 2111 6718 4897 5225 3470 786...
result:
ok OK (n = 10000, m = 200000)
Test #8:
score: 0
Accepted
time: 746ms
memory: 46728kb
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:
6006 2005 9884 7106 7456 4243 1782 3776 2595 7761 2003 3152 1758 830 1147 5774 4821 1306 9874 1043 2975 2206 720 6192 5755 5022 5450 6894 4189 483 3814 9536 1848 6586 4371 2590 2635 8468 4460 3246 4956 8515 4615 9011 6543 2162 139 6506 8774 8974 6922 8013 7494 9271 7007 2268 6940 5489 7221 3078 4784...
result:
ok OK (n = 10000, m = 200000)
Test #9:
score: 0
Accepted
time: 686ms
memory: 46540kb
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:
2247 8670 3323 3395 7781 4792 2327 9935 2208 1886 6193 5875 6716 8746 7213 8929 1531 8873 3491 294 9279 3531 9348 9599 2587 6781 4950 5816 548 5870 8133 7730 8144 3432 2107 4228 1965 4716 6188 4985 6988 2680 2177 6572 7293 8673 6863 7263 3960 352 8176 5139 9544 9278 8679 5517 117 3745 1897 1786 9403...
result:
ok OK (n = 10000, m = 200000)
Test #10:
score: 0
Accepted
time: 729ms
memory: 46648kb
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:
1992 4580 8413 3332 3036 6600 2073 9184 8015 8059 3594 7045 3679 694 2716 5939 8991 8863 3254 8774 4259 9407 6404 1769 9082 9209 9657 6399 103 6251 7059 4199 3427 4789 2894 5919 2517 3411 894 2725 7541 5871 9844 6040 5143 1734 8166 3165 217 5542 9583 2625 8406 2696 4820 8295 4371 8096 1925 2428 9243...
result:
ok OK (n = 10000, m = 200000)
Test #11:
score: 0
Accepted
time: 708ms
memory: 47112kb
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:
308 9951 6773 5063 8159 6423 9914 9231 8751 424 8732 8115 8201 7774 7208 9774 6716 9568 3618 3406 845 5314 2373 6481 5737 3699 1984 7416 307 1165 6617 9533 5454 4706 5189 5350 8895 8821 705 1837 9263 1269 8067 7365 3490 3383 3567 8360 9381 8140 6427 6737 3483 1664 870 5622 8988 322 5235 9591 5635 47...
result:
ok OK (n = 10000, m = 200000)
Test #12:
score: 0
Accepted
time: 779ms
memory: 45948kb
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:
1547 3047 371 1105 5658 2237 2298 2428 6885 7601 9245 77 4497 3522 1756 8466 9737 8643 5470 4238 6459 4989 185 3043 1838 3886 1591 5300 7101 5847 4592 4980 4401 6536 7529 2073 1748 8781 2422 7229 4434 2372 5223 8749 9193 5543 4264 839 2287 6697 9478 9187 1211 9866 1717 2750 8100 4187 3610 3123 5466 ...
result:
ok OK (n = 10000, m = 200000)
Test #13:
score: 0
Accepted
time: 724ms
memory: 46952kb
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:
5811 2650 2219 6293 9840 4537 9587 3779 3817 7722 9373 8603 406 7168 5633 5309 4043 9669 4053 2961 9811 1975 8169 6401 616 4309 4693 2357 3463 8734 999 9477 8703 2714 7834 3448 1220 4326 8335 1012 1718 7265 5081 9692 2891 619 7027 5180 3984 6778 8969 7235 2057 2104 2856 671 7112 6776 4345 3117 9808 ...
result:
ok OK (n = 10000, m = 200000)
Test #14:
score: 0
Accepted
time: 752ms
memory: 45796kb
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:
2380 7772 2701 6020 7049 2464 823 1910 9181 5238 1059 4638 8106 3714 434 4720 3412 7442 3306 8130 5411 5288 9682 1915 5240 4998 6373 3479 9996 5374 2547 4843 3915 1746 6785 1685 2404 110 8606 7421 9589 3469 746 5353 7667 2195 1862 3693 6374 508 8745 225 3185 5912 4947 5691 148 5570 2737 3510 5056 64...
result:
ok OK (n = 10000, m = 200000)
Test #15:
score: 0
Accepted
time: 717ms
memory: 47236kb
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:
6109 9635 2033 8853 8402 4821 3897 4697 3079 3405 2631 2778 2921 7119 3171 6962 690 2821 7963 5969 6250 3040 6125 2090 8753 1173 703 5199 8945 7291 4809 8758 8370 6242 2976 8921 3766 6676 6656 6258 3769 4326 9926 7884 9981 9400 2803 406 1293 5294 4446 3772 6276 1506 2376 2981 1599 6461 2452 8316 223...
result:
ok OK (n = 10000, m = 200000)
Test #16:
score: 0
Accepted
time: 737ms
memory: 46008kb
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:
2272 8666 7910 4163 2682 8374 2502 7701 3808 8612 3677 9647 5075 1139 2153 2785 187 4955 9126 319 596 6562 394 8301 7270 6076 8402 2803 789 5857 911 2876 7088 4552 4868 1644 9542 858 5865 6271 4183 5590 7223 3628 6895 1221 8732 3701 5970 4978 7527 1637 1252 6031 4560 1899 6864 3131 7112 2531 1723 27...
result:
ok OK (n = 10000, m = 200000)
Test #17:
score: 0
Accepted
time: 765ms
memory: 47408kb
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:
5626 5440 4737 2427 8118 595 1938 3813 9562 9226 4232 8473 5613 9112 7247 8509 4787 2649 7524 4779 4758 8537 6117 6644 1902 4078 2848 2903 1385 5003 9355 3649 7285 1763 7686 9894 5293 2825 8967 6605 8811 8262 6661 6335 9260 2268 683 9420 281 9069 5039 8883 2985 8990 2062 405 852 6182 8108 8298 8424 ...
result:
ok OK (n = 10000, m = 200000)
Test #18:
score: 0
Accepted
time: 710ms
memory: 46572kb
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:
3667 2555 4678 3557 1686 7480 4574 801 8264 9759 8373 7124 5938 3221 5598 625 7302 864 9106 2527 1112 1814 1606 4169 1582 4600 6935 4895 8615 3956 2264 6079 6285 5034 7356 8080 5014 7807 2986 4315 4986 1149 6062 3771 4059 9060 2212 4786 7652 8191 3009 3024 2945 5493 3240 9301 2018 2257 9278 8969 599...
result:
ok OK (n = 10000, m = 200000)
Test #19:
score: 0
Accepted
time: 713ms
memory: 47248kb
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:
7647 3467 2361 3819 2953 6457 1897 1106 6311 6071 3840 1898 8002 1847 5724 9331 13 7781 9389 8828 5684 7223 3067 7675 5830 9562 1399 6364 8440 8286 1227 6840 7872 1068 1349 1761 3705 221 5307 5613 1622 6353 9756 5350 9089 6984 2093 2612 1094 5625 3372 524 4188 9171 9266 9948 5512 2323 7211 4200 4112...
result:
ok OK (n = 10000, m = 200000)
Test #20:
score: 0
Accepted
time: 710ms
memory: 46812kb
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:
9337 8133 6214 2338 3598 9113 9347 8692 5162 8127 9367 1243 4361 1364 6206 4813 2737 58 5453 8479 2005 1256 4710 3020 5346 5300 3743 1695 3278 5779 2959 245 8011 9359 6579 8066 9733 5718 2208 7803 3200 3565 9923 4100 5608 2289 2663 7484 9851 2517 8003 4134 2201 2274 3118 5473 4601 2693 8964 6946 993...
result:
ok OK (n = 10000, m = 200000)
Test #21:
score: 0
Accepted
time: 707ms
memory: 46212kb
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:
6292 8310 7834 9840 9099 5822 8484 3089 618 8078 4160 4064 1510 352 7934 4262 7763 1344 8192 1420 9249 5508 3574 2038 2234 5413 995 7539 7935 8402 9088 1631 9223 6785 7341 7392 7784 4840 8865 4924 7838 1535 3484 7291 8162 2046 8881 6143 4891 1392 6858 8698 9957 5766 7628 5739 3039 5361 9744 8424 152...
result:
ok OK (n = 10000, m = 200000)
Test #22:
score: 0
Accepted
time: 718ms
memory: 46428kb
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:
1309 6142 9976 4831 1465 4423 5420 9493 9651 402 7727 5572 2402 9035 6461 5523 9644 6960 2468 5927 8812 6776 3708 2585 1220 9216 2811 2963 9276 8254 8598 5136 9254 806 5661 7591 5374 2479 5889 2637 4544 7952 3979 1313 6742 8924 2364 5220 9800 7174 5014 8528 6947 2577 2714 5387 1951 1489 8483 757 903...
result:
ok OK (n = 10000, m = 200000)
Test #23:
score: 0
Accepted
time: 723ms
memory: 46576kb
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:
2061 6453 4711 2059 2717 7982 403 1802 9513 4869 9844 1335 8475 3111 4291 5203 9388 7612 2953 5789 7181 9889 9811 5440 8635 2286 1182 5223 8492 4995 8499 5563 1434 8537 3088 3630 4970 9673 2356 3750 4924 1887 9726 9372 2633 378 5118 1904 6616 5802 6875 8663 2535 3368 5672 530 5107 1474 1112 8824 101...
result:
ok OK (n = 10000, m = 200000)
Test #24:
score: 0
Accepted
time: 698ms
memory: 48380kb
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:
6483 9466 8728 4890 5349 4048 6429 515 28 5875 1646 2588 2151 4093 8073 7413 6043 5468 9490 3546 1395 8006 4105 4811 1618 2479 7947 3895 1937 5900 4123 5492 1360 8120 3424 3215 9710 413 1457 9358 6583 7943 7033 5568 2869 9355 3387 2200 6640 5058 7451 4596 7623 5759 8283 6063 923 2678 4996 6451 4320 ...
result:
ok OK (n = 10000, m = 200000)
Test #25:
score: 0
Accepted
time: 734ms
memory: 47848kb
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:
3839 8871 8019 6399 8137 6901 5065 5487 3227 2385 6919 9413 6961 5515 9927 3061 2838 5435 4595 727 7083 5555 8006 7598 7794 5886 7868 9285 106 9311 734 4368 1069 6362 7361 7607 4793 2210 4701 2491 5187 6437 5033 3029 3713 200 231 2737 8746 9101 5036 1950 6850 315 3496 7058 2290 5654 7795 6387 1477 9...
result:
ok OK (n = 10000, m = 200000)
Test #26:
score: 0
Accepted
time: 720ms
memory: 46444kb
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:
4853 5699 4644 8272 5360 4171 325 5954 1695 4758 6135 1762 1574 5531 6561 7420 5543 1892 6252 1020 2182 1875 7909 8144 7908 4067 9877 4097 2448 5586 2646 7805 8205 3312 5703 3536 6181 6053 7479 8843 8367 8143 4799 7071 300 9747 7397 7556 2966 4923 4891 7581 6686 681 310 5652 6340 8471 5972 5723 7651...
result:
ok OK (n = 10000, m = 200000)
Test #27:
score: 0
Accepted
time: 710ms
memory: 46804kb
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:
1399 6707 1308 3174 3885 9742 9124 7078 8927 4785 9363 4933 4270 276 4308 2536 5354 4084 9973 8829 1349 9349 2285 662 5885 4430 1948 8674 2523 1726 4420 6992 8108 699 5957 1321 2239 6923 7326 65 943 7023 1391 774 3905 8518 1837 6109 2075 7622 2625 640 3584 6793 2280 4252 1192 303 3943 9633 75 5990 8...
result:
ok OK (n = 10000, m = 200000)
Test #28:
score: 0
Accepted
time: 696ms
memory: 46460kb
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:
6941 404 6123 6234 3216 5201 1023 2032 3943 4749 6135 2452 3701 1411 565 7218 9237 2789 7221 5302 6994 819 4276 8459 8221 5063 9796 8878 8594 6747 7719 2273 2406 8211 6302 1872 8697 9159 9832 5365 4776 6340 5309 37 716 3339 6241 5090 2370 991 8129 4275 2066 2844 5808 9969 9473 2408 9716 6312 1137 86...
result:
ok OK (n = 10000, m = 200000)
Test #29:
score: 0
Accepted
time: 732ms
memory: 46204kb
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:
2370 7261 654 4641 3756 3588 687 4240 355 1143 3925 4721 4671 9777 7872 4512 4812 8400 5196 963 210 9832 5252 2618 1892 5046 1717 4056 9104 4567 3728 4271 1207 8795 9638 4529 4218 9056 757 5063 6849 9926 3468 8952 5509 2112 6826 1313 864 8316 8119 6141 3914 2082 8413 6061 1579 6781 1526 5427 6342 41...
result:
ok OK (n = 10000, m = 200000)
Test #30:
score: 0
Accepted
time: 728ms
memory: 47444kb
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:
4064 7206 2307 2588 7533 5938 5033 8295 8018 4362 6059 9235 802 2852 9789 8755 8157 2211 5666 5390 3530 1268 4665 1655 6244 8072 4201 6849 3852 8800 3622 4953 4685 9290 8879 8738 980 9727 3879 8274 7342 4390 3446 5240 332 4070 6999 9565 2655 3468 3131 1292 8286 3533 7024 6916 5969 8006 6748 496 8872...
result:
ok OK (n = 10000, m = 200000)
Test #31:
score: 0
Accepted
time: 684ms
memory: 46448kb
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:
422 4093 6023 8903 3797 2588 8471 2364 6837 7721 7336 1299 1528 7301 3960 8754 6106 9204 4517 3086 265 8159 9728 2562 2092 1970 5596 7032 7752 7795 2843 6081 6866 5577 5004 3467 2269 8939 9282 5042 4126 1906 6744 6822 9310 9664 1584 1490 8684 8789 3285 8977 2216 8668 4492 4235 3196 364 3770 9171 370...
result:
ok OK (n = 10000, m = 200000)
Extra Test:
score: 0
Extra Test Passed