QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#434385 | #8787. Unusual Case | ucup-team052# | AC ✓ | 948ms | 48720kb | C++23 | 6.7kb | 2024-06-08 16:00:07 | 2024-06-08 16:00:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937_64 rnd((long long)new char());
int Rnd(int l,int r) {return rnd()%(r-l+1)+l;}
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;
}
}
}
}
vi out, in;
vi work(int n, vector<pi> eg, ll mx_ch = -1) { // mx_ch : 最大调整次数 如果不设初值,默认为(n + 100) * (n + 50)
// 如果存在,有较大概率返回一条路径
// 如果失败 返回0
out.resize(n + 1), in.resize(n + 1);
LCT::init(n);
for (int i = 0; i <= n; i++) in[i] = out[i] = 0;
if (mx_ch == -1) mx_ch = 1ll * (n + 100) * (n + 50);
vector<vi> from(n + 1), to(n + 1);
for (auto v : eg)
from[v.fi].pb(v.se),
to[v.se].pb(v.fi);
unordered_set<int> canin, canout;
for (int i = 1; i <= n; i++)
canin.insert(i),
canout.insert(i);
mt19937 x(time(0));
int tot = 0;
while (mx_ch >= 0) {
// cout << tot << ' ' << mx_ch << endl;
vector<pi> eg;
for (auto v : canout)
for (auto s : from[v])
if (in[s] == 0) {
assert(canin.count(s));
continue;
}
else eg.pb(mp(v, s));
for (auto v : canin)
for (auto s : to[v])
eg.pb(mp(s, v));
shuffle(eg.begin(), eg.end(), x);
if (eg.size() == 0) break;
for (auto v : eg) {
mx_ch--;
if (in[v.se] && out[v.fi]) continue;
if (LCT::fdr(v.fi) == LCT::fdr(v.se)) continue;
if (in[v.se] || out[v.fi])
if (x() & 1) continue;
if (!in[v.se] && !out[v.fi])
tot++;
if (in[v.se]) {
LCT::cut(in[v.se], v.se);
canin.insert(v.se);
canout.insert(in[v.se]);
out[in[v.se]] = 0;
in[v.se] = 0;
}
if (out[v.fi]) {
LCT::cut(v.fi, out[v.fi]);
canin.insert(out[v.fi]);
canout.insert(v.fi);
in[out[v.fi]] = 0;
out[v.fi] = 0;
}
LCT::link(v.fi, v.se);
canin.erase(v.se);
canout.erase(v.fi);
in[v.se] = v.fi;
out[v.fi] = v.se;
}
if (tot == n - 1) {
vi cur;
for (int i = 1; i <= n; i++)
if (!in[i]) {
int pl = i;
while (pl) {
cur.pb(pl),
pl = out[pl];
}
break;
}
return cur;
}
}
//fail to find a path
return vi();
}
}
#define N 200005
int u[N],v[N],id[N],vis[N],n,m,k;
unordered_map<int,int> rev;
vector<int> ans[8];
signed main()
{
#ifdef wasa855
freopen("a.in","r",stdin);
#endif
cin>>n>>m>>k;
for(int i=1;i<=m;i++) scanf("%d %d",&u[i],&v[i]);
for(int i=1;i<=m;i++) rev[u[i]*(n+1)+v[i]]=i,rev[v[i]*(n+1)+u[i]]=i;
while(1)
{
for(int i=1;i<=m;i++) vis[i]=0;
int ok=1;
for(int i=0;i<k;i++)
{
vector<pair<int,int>> vg;
for(int j=1;j<=m;j++) if(!vis[j])
{
vg.emplace_back(u[j],v[j]);
vg.emplace_back(v[j],u[j]);
}
ans[i]=hamil::work(n, vg);
if(ans[i].empty()) {ok=0; break;}
for(int j=0;j+1<n;j++) vis[rev[ans[i][j]*(n+1)+ans[i][j+1]]]=1;
}
if(!ok) continue;
for(int i=0;i<k;i++) for(int j=0;j<n;j++) printf("%d%c",ans[i][j]," \n"[j==n-1]);
exit(0);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6016kb
input:
5 9 2 1 3 1 4 1 5 2 3 2 4 2 5 3 5 4 3 5 4
output:
2 5 4 1 3 2 4 3 5 1
result:
ok OK (n = 5, m = 9)
Test #2:
score: 0
Accepted
time: 872ms
memory: 46232kb
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:
4397 1410 2388 9635 7257 7915 1152 4265 8076 7303 3895 8710 2383 4091 4919 4171 674 6599 8779 2967 2299 2443 6906 3557 4038 9733 1117 7913 2191 9655 583 9314 3037 7203 4344 9670 3087 594 6688 7561 9784 5234 5124 8173 3144 6345 6856 1019 1352 9829 2338 6169 6738 4065 3094 472 5531 2592 5203 607 4058 ...
result:
ok OK (n = 10000, m = 200000)
Test #3:
score: 0
Accepted
time: 883ms
memory: 46488kb
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:
5275 3477 3458 9342 208 8808 4069 4553 7865 3749 3341 4424 2182 8634 5718 6179 8861 5996 4060 7605 2047 9925 351 3259 9210 5430 2529 8714 5103 773 7995 3606 5323 1451 630 9331 8132 9921 7944 2878 66 7516 7892 2982 2650 7758 3184 3226 9950 7755 227 5008 8642 7626 1406 5439 4468 712 3346 2472 5591 321...
result:
ok OK (n = 10000, m = 200000)
Test #4:
score: 0
Accepted
time: 871ms
memory: 46532kb
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:
3693 6293 8679 3716 4865 2648 465 1375 5592 4806 5617 6534 2567 9597 1693 4834 4827 2303 4301 2341 7558 2422 2917 552 1187 9723 4166 721 29 4069 9458 8859 2896 6269 6301 2618 6886 7847 3170 3174 8227 933 8050 2755 4190 6431 6602 2441 9063 4849 7773 4366 2698 5764 2340 4485 7055 481 1524 7452 6908 39...
result:
ok OK (n = 10000, m = 200000)
Test #5:
score: 0
Accepted
time: 828ms
memory: 45236kb
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:
5232 5120 2266 1327 8139 5679 9446 6119 6288 6032 6990 1217 9587 8552 9676 8838 3198 8606 9117 4685 4541 3763 30 9775 6190 7773 35 9851 5106 8331 5971 3807 899 8231 341 3020 5979 7527 5729 7920 8412 5860 5279 8309 7877 8647 5409 7831 3563 3641 4535 7672 4202 1740 1361 2041 2472 2052 2602 8387 9952 5...
result:
ok OK (n = 10000, m = 200000)
Test #6:
score: 0
Accepted
time: 903ms
memory: 45272kb
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:
5456 6986 5887 3441 7368 8458 3893 5137 7894 1480 8287 4853 1615 8143 2180 5803 267 3101 5678 643 6278 4252 2860 7450 2320 9403 141 3279 2369 8523 9584 9598 6253 205 7323 7319 7760 5461 2048 6482 4396 9230 8681 5201 1395 407 3506 1893 2342 6543 3724 5104 6295 2538 2016 1461 5085 1550 3714 6688 3243 ...
result:
ok OK (n = 10000, m = 200000)
Test #7:
score: 0
Accepted
time: 773ms
memory: 48720kb
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:
8101 8285 2242 5069 7387 6422 9660 3963 584 6718 6808 2101 1587 8940 6953 7083 1606 8644 6743 6841 7943 9540 1205 881 5475 837 2490 4979 6250 2628 4919 5440 1942 8897 8340 8313 7931 3560 1967 9484 9394 8067 2140 6093 7194 9612 9118 216 9791 6152 6107 9363 8807 8434 4787 4908 850 1296 5227 7115 2312 ...
result:
ok OK (n = 10000, m = 200000)
Test #8:
score: 0
Accepted
time: 857ms
memory: 46508kb
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:
2610 1772 1212 3354 8139 4260 101 3993 4914 340 9558 5204 2363 4328 2926 2290 3011 6623 5300 4301 172 5793 5977 2071 993 488 6380 9004 7786 8229 7182 5744 3668 8821 9950 6124 9978 4304 4895 1088 9131 1210 3594 5277 2350 3013 2449 5307 5263 7437 256 7577 2893 9095 433 4932 5039 5675 9962 6558 9576 85...
result:
ok OK (n = 10000, m = 200000)
Test #9:
score: 0
Accepted
time: 848ms
memory: 47960kb
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:
5132 5088 2449 3310 7117 7742 3394 1542 8719 2214 3853 2598 3582 5401 6637 5199 2009 6758 1698 6316 244 8979 9541 2249 2894 2467 2809 5542 7872 2171 8264 428 3986 4457 2060 6095 1350 6922 2483 7119 1920 6929 2382 474 3447 4972 2327 1013 4520 1601 6464 151 1130 2124 4997 8436 4011 3087 9322 2468 331 ...
result:
ok OK (n = 10000, m = 200000)
Test #10:
score: 0
Accepted
time: 794ms
memory: 47072kb
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:
263 6959 1377 7666 8932 3155 9711 6433 9299 5895 2310 8316 1472 9691 4623 844 5235 6100 9593 5632 7833 4336 7432 5441 224 1057 2037 5403 1093 9112 7992 6179 6689 3750 2998 2402 5692 1394 9498 7931 6201 1838 617 7263 6047 8718 1889 2278 276 6870 7789 9923 3304 5912 1643 4735 9055 2360 5769 7664 9531 ...
result:
ok OK (n = 10000, m = 200000)
Test #11:
score: 0
Accepted
time: 840ms
memory: 47136kb
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:
1512 1958 8741 8174 1890 2552 3504 1591 3284 3624 6203 3342 4064 2603 7610 8077 4684 8059 4897 3983 184 8984 8471 6074 2559 9280 3132 4527 2246 2890 453 7822 8869 3793 1240 5780 1444 5471 7300 9874 4687 5921 5971 3794 6022 5028 7933 8567 572 4583 5818 9163 4746 339 8811 2940 3900 7661 5742 4569 279 ...
result:
ok OK (n = 10000, m = 200000)
Test #12:
score: 0
Accepted
time: 909ms
memory: 46844kb
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:
2146 714 9056 9663 4065 1969 9878 1135 8145 2240 1359 1871 2451 2112 9573 7077 5577 1551 7824 6543 8188 1428 4865 6026 5471 5862 6558 3922 3636 7087 5698 1403 9507 7903 1442 1591 8764 7277 5539 5107 1949 5821 4033 4756 6788 4119 1453 8475 673 8978 2356 5907 5226 8889 9242 8589 9482 6429 2778 7419 66...
result:
ok OK (n = 10000, m = 200000)
Test #13:
score: 0
Accepted
time: 878ms
memory: 46948kb
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:
4800 7891 5155 2571 2121 7753 3899 7428 6667 476 7695 5147 4620 3766 7260 2437 4205 7699 2054 532 2280 8745 9199 9631 896 2516 8662 3661 5490 1439 6734 867 3350 8419 2916 1221 1288 7379 1869 8537 700 8264 7377 6950 6797 9882 9835 6281 3236 6941 5976 8581 1216 1613 5414 3429 4149 8058 2383 4202 2284 ...
result:
ok OK (n = 10000, m = 200000)
Test #14:
score: 0
Accepted
time: 849ms
memory: 47880kb
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:
4000 3645 8861 5788 6661 4687 6729 4776 4662 9132 2035 1558 8475 7016 8252 7567 500 5118 2893 1536 4440 5469 4135 4716 5664 1784 1787 4025 2117 2658 350 3528 3454 1280 7702 5210 8520 945 6036 7970 869 6293 5522 8896 5275 6831 2950 8017 5347 637 8116 9055 9461 6173 2079 3010 2153 7247 8711 7111 9100 ...
result:
ok OK (n = 10000, m = 200000)
Test #15:
score: 0
Accepted
time: 847ms
memory: 47412kb
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:
973 2844 5860 3815 3222 1083 8826 4299 9040 8910 2279 7504 4450 974 8815 8643 6496 9732 6615 4920 9339 5644 4571 5113 7436 9874 7656 4540 9138 2664 4769 1566 9795 8403 2316 1723 6097 891 8959 4023 6002 9465 2498 815 5246 7490 5740 6295 4496 6417 4513 6182 6127 4930 3493 990 6783 7842 4548 2927 2240 ...
result:
ok OK (n = 10000, m = 200000)
Test #16:
score: 0
Accepted
time: 940ms
memory: 46028kb
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:
6009 4315 3782 9468 1673 5444 3687 8641 9472 1788 9181 6680 5628 7255 2508 4607 9399 3400 5157 4936 2840 8779 3438 9958 8705 5059 5866 9945 8610 4299 4561 4493 2976 5171 4730 2032 1808 2360 3540 3503 5812 7464 4574 1041 5232 2073 1190 8103 4119 6124 215 3033 1843 416 7456 7769 1537 1710 8563 626 839...
result:
ok OK (n = 10000, m = 200000)
Test #17:
score: 0
Accepted
time: 871ms
memory: 45636kb
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:
7456 5306 5666 9460 5500 8861 4058 172 4759 7576 7947 4681 9650 5604 2853 2967 6333 3885 199 7254 9489 8123 5159 6749 1337 3637 3724 6005 5933 2623 8135 6452 9635 7179 6699 3202 125 5548 788 8864 8782 6117 905 1523 3761 4180 8533 8916 8185 9076 3775 4285 6169 4601 5344 9250 537 5580 2272 8867 9691 3...
result:
ok OK (n = 10000, m = 200000)
Test #18:
score: 0
Accepted
time: 791ms
memory: 47144kb
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:
7103 1552 3340 1160 7562 242 6707 4716 2304 9920 2390 1937 3489 4484 6968 1162 2469 1462 1020 410 5955 4475 988 4652 6019 2817 6686 5043 3424 771 1311 5085 8186 782 7546 2378 8240 9393 4877 646 8962 75 29 1780 2364 2150 8350 6517 3354 2896 9475 1726 4404 7199 8640 3520 9010 8272 7519 9033 3334 7333 ...
result:
ok OK (n = 10000, m = 200000)
Test #19:
score: 0
Accepted
time: 874ms
memory: 46244kb
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:
6272 3532 2273 7012 4830 208 2032 8169 9456 7776 8870 6996 1460 847 7661 3123 6133 4091 6783 2164 6427 2728 7308 2134 2306 3300 2462 7511 6459 4882 8718 8238 7570 3156 2374 8673 2113 3450 1559 3924 6031 5078 6873 2654 7577 6185 6811 8441 563 3569 5436 8672 2312 7759 1566 8033 446 4973 9848 9316 3740...
result:
ok OK (n = 10000, m = 200000)
Test #20:
score: 0
Accepted
time: 902ms
memory: 47884kb
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:
5891 9763 477 948 5221 9267 1691 2705 6187 6998 5757 8390 5975 498 4268 7810 7338 5208 5583 2485 9233 2054 7433 9229 8782 9821 7906 1183 6376 2343 9781 5917 6044 5341 9500 170 241 9443 901 9261 4875 4306 5769 6434 3519 2661 1825 7167 2190 5752 5291 5589 9864 5050 150 6040 9512 2258 5413 765 8692 359...
result:
ok OK (n = 10000, m = 200000)
Test #21:
score: 0
Accepted
time: 907ms
memory: 46604kb
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:
9477 4921 6291 9089 8483 4054 7687 8419 2026 1651 6124 8209 8065 1750 3062 4157 4230 2808 2915 133 4464 379 8291 4656 7505 7381 9023 630 99 7499 4165 7129 5968 1265 7091 8219 9887 7161 1230 7020 598 7928 6950 7360 1185 2655 9651 1511 3331 1033 3463 6953 4292 4913 4277 5605 1469 5302 8828 6521 4870 4...
result:
ok OK (n = 10000, m = 200000)
Test #22:
score: 0
Accepted
time: 828ms
memory: 46744kb
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:
3164 1117 4528 1571 3744 1613 2469 4561 3742 9764 5501 3670 309 4401 5459 9669 1821 1820 2325 658 9468 9738 7454 23 3804 2470 7187 5895 788 6881 4280 2240 5477 8200 4896 1049 1786 1521 2859 6465 9993 8675 9956 2480 5133 3227 653 2664 2856 3808 4387 9304 4775 303 7137 6848 6551 2147 5189 7705 1023 66...
result:
ok OK (n = 10000, m = 200000)
Test #23:
score: 0
Accepted
time: 862ms
memory: 45248kb
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:
5587 6353 790 1759 1919 1998 3049 9802 7176 7207 1193 7658 3284 3172 8675 4806 1074 9749 8627 4569 9646 7545 7657 3640 9562 4944 4929 6354 3704 9707 7349 9021 4752 8871 1760 2590 6042 2145 4999 5066 2949 7736 9320 6606 6582 3076 8736 7737 5227 1791 456 9729 2142 2650 4013 6128 966 8960 1967 3245 720...
result:
ok OK (n = 10000, m = 200000)
Test #24:
score: 0
Accepted
time: 872ms
memory: 46416kb
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:
2423 4773 5071 2483 6739 8952 1169 4935 8203 4878 4459 5675 5243 732 4119 1689 8583 7054 8065 5541 4020 7376 1899 3884 5495 6644 7083 3384 7452 9315 7278 4731 2158 3228 4025 2983 7857 8280 371 4503 6040 4343 8650 1862 1571 5406 2968 2876 4374 8227 3661 2731 9680 4914 5145 3611 8503 5505 5161 3246 93...
result:
ok OK (n = 10000, m = 200000)
Test #25:
score: 0
Accepted
time: 852ms
memory: 45828kb
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:
8612 4542 8327 7092 2581 5773 3761 6575 3145 8701 6738 3219 8822 2370 7558 6093 799 6646 9212 9496 1982 5268 7611 3563 2992 941 9612 8298 1065 9541 4823 9780 5309 2428 7879 6452 66 3475 840 7208 54 9765 2669 2858 9666 5353 8764 3428 6769 3272 7624 6468 9288 5573 6880 1012 4311 1239 2896 944 6307 757...
result:
ok OK (n = 10000, m = 200000)
Test #26:
score: 0
Accepted
time: 892ms
memory: 45968kb
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:
1804 282 6703 7124 5760 7098 9252 3763 3601 7880 8738 7435 958 9896 9342 2095 8287 4009 1010 9916 6704 5087 592 4833 4137 2905 7477 2277 4238 2640 3847 8716 5517 6800 4569 8286 8811 9305 1130 1486 7119 195 5579 9651 2442 8323 5668 4664 779 535 2818 5122 924 9499 1577 5063 8239 3630 7884 86 3867 2774...
result:
ok OK (n = 10000, m = 200000)
Test #27:
score: 0
Accepted
time: 828ms
memory: 46592kb
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:
8917 2296 5237 227 2697 6631 8649 8063 6806 1394 238 4679 8052 4137 5531 5725 1902 424 723 6930 4522 528 3554 7124 9210 3997 1551 7781 7589 2589 5911 768 823 5601 5737 1398 2538 2947 4104 6569 496 1502 8939 822 9241 4891 9736 593 4029 8543 816 9005 3907 240 3881 8454 8159 517 9522 1159 3068 8113 133...
result:
ok OK (n = 10000, m = 200000)
Test #28:
score: 0
Accepted
time: 825ms
memory: 46848kb
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:
5745 9363 2548 3246 1582 1809 1678 3992 1699 8753 9309 5103 5786 3825 6176 1589 3358 9078 7379 7430 1966 1174 9140 3376 8151 8100 9623 8360 6759 1347 6060 3410 5244 7370 6983 7124 7832 9331 420 736 2631 4019 5871 4672 8632 7317 9957 2879 5302 8107 9626 5355 1291 5921 1723 5190 9011 6889 8967 593 519...
result:
ok OK (n = 10000, m = 200000)
Test #29:
score: 0
Accepted
time: 873ms
memory: 46248kb
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:
5202 863 6850 1234 4414 1777 4283 7483 4919 8872 4107 7024 5048 1185 7613 5652 4513 1368 5003 5492 2577 1344 1908 6897 67 3300 4565 1726 2871 1284 761 7056 6775 9634 370 5871 975 3352 244 688 2207 1047 4810 5910 2669 1615 5940 6388 7172 5728 5303 8861 240 3384 9289 7763 5916 1080 9516 2035 2804 7344...
result:
ok OK (n = 10000, m = 200000)
Test #30:
score: 0
Accepted
time: 948ms
memory: 46572kb
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:
1847 1687 4949 2210 5284 4674 2167 2551 8815 5131 1184 9989 5909 7122 8634 9555 618 9469 2899 2750 2794 8074 2991 5726 4639 8442 7218 7484 1283 8735 1969 7008 1466 1168 2672 3442 1939 5526 3672 7797 2437 9778 9992 7588 6865 2231 6614 2281 6459 8022 7902 7256 21 6645 5231 6620 5447 8699 2969 4250 492...
result:
ok OK (n = 10000, m = 200000)
Test #31:
score: 0
Accepted
time: 906ms
memory: 47524kb
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:
383 9031 7231 3919 7637 1021 9681 8625 2490 7991 1658 4070 2546 6948 1917 7732 3580 635 8628 9185 2127 869 8778 7894 8409 2368 7228 1136 6865 3313 1810 5982 3356 1472 6857 5690 9467 5087 4293 6074 9064 659 2280 6822 7965 5252 7153 3771 9267 5381 4962 4971 1604 937 7520 1328 1469 9957 509 7287 5524 3...
result:
ok OK (n = 10000, m = 200000)
Extra Test:
score: 0
Extra Test Passed