QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667127 | #8787. Unusual Case | ucup-team134 | AC ✓ | 2603ms | 224016kb | C++17 | 7.1kb | 2024-10-22 21:09:07 | 2024-10-22 21:09:26 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ld long double
#define li __int128
using namespace std;
mt19937 rng(time(NULL));
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 : 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.
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); //default
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(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 : 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;
}
}
//failed to find a path
return vi();
}
}
int n,m,k;
vector<vector<int>> ans;
void solve(vector<pair<int,int>> ed){
if(sz(ans)==k){
for(auto p:ans){
for(auto d:p){
printf("%i ",d);
}
printf("\n");
}
exit(0);
}
for(int k=0;k<2;k++){
auto an=hamil::work(n,ed,1e7);
if(sz(an)==0)continue;
map<pair<int,int>,int> rm;
for(int i=0;i<sz(an)-1;i++){
rm[{min(an[i],an[i+1]),max(an[i],an[i+1])}]=1;
rm[{max(an[i],an[i+1]),min(an[i],an[i+1])}]=1;
}
vector<pair<int,int>> ned;
for(auto p:ed){
if(!rm[p]){
ned.pb(p);
}
}
ans.pb(an);
solve(ned);
ans.pop_back();
}
}
int main()
{
ios;
cin >> n >> m >> k;
vector<pair<int,int>> ed;
for(int i=0;i<m;i++){
int x,y;
cin >> x >> y;
ed.pb({x,y});
ed.pb({y,x});
}
while(1)
solve(ed);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3792kb
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 4 1 5 2 4 5 3 1
result:
ok OK (n = 5, m = 9)
Test #2:
score: 0
Accepted
time: 2421ms
memory: 217680kb
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:
9734 552 7308 8655 7901 477 3552 3680 3529 6501 5637 762 5475 8718 4200 8687 6686 4251 1614 6249 8536 6829 5653 2075 9494 8461 4664 6918 3830 768 2839 6075 1249 5771 7189 5818 6614 4762 8716 6380 5904 1571 2225 4296 4152 7151 4960 4791 1244 5149 8877 1762 1552 2471 6437 4627 9691 9287 3240 239 4858 ...
result:
ok OK (n = 10000, m = 200000)
Test #3:
score: 0
Accepted
time: 2281ms
memory: 222076kb
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:
3263 1056 644 4918 7808 5398 4191 6652 8607 1323 2091 4486 5333 318 5646 7235 8456 3213 6555 1348 8962 4001 3859 4455 6390 6724 3927 6423 2434 6826 4890 4158 4419 5494 6479 1731 9836 3447 7740 5371 509 7705 9148 8128 5350 602 5752 4952 7619 9094 8826 324 9501 3196 5884 6992 1103 4557 8039 6600 6590 ...
result:
ok OK (n = 10000, m = 200000)
Test #4:
score: 0
Accepted
time: 2319ms
memory: 219624kb
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:
8234 7594 3891 5805 8052 5251 8412 6477 853 1257 7194 4141 5801 6503 2497 1203 8824 6336 6829 460 4152 6050 479 2503 9148 2624 6676 5447 7836 7069 418 1723 5533 5369 5531 6919 3753 762 4249 9208 9988 7047 1340 5746 2881 5371 4957 96 7310 4590 1883 4722 2241 9392 1343 6989 9783 3927 9037 6380 2418 49...
result:
ok OK (n = 10000, m = 200000)
Test #5:
score: 0
Accepted
time: 2231ms
memory: 223280kb
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:
7679 4904 8143 1814 9328 6715 8149 19 1927 3641 3427 4063 6759 7202 6907 7530 6497 1864 7608 145 6135 4900 2766 9551 1059 3805 4369 7497 2149 4383 6578 2392 3500 3060 3913 2662 128 5855 7831 9811 6906 9060 2864 6570 1445 3199 7483 4277 8267 8845 4705 7611 8 8047 364 5165 7662 4067 4681 6336 2354 376...
result:
ok OK (n = 10000, m = 200000)
Test #6:
score: 0
Accepted
time: 2360ms
memory: 218196kb
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:
616 3702 6474 6512 234 2180 3963 6810 145 4448 1497 4831 8258 9763 3664 5289 1736 3700 5199 8599 8426 3774 7757 6347 6980 1388 3035 3485 9421 6676 2247 799 9393 4275 8673 245 9483 7390 5440 5675 6379 6253 8508 5559 7939 7821 1368 1278 7482 5880 4661 4247 1024 6449 2173 4454 1707 6345 918 6375 6174 8...
result:
ok OK (n = 10000, m = 200000)
Test #7:
score: 0
Accepted
time: 2386ms
memory: 221404kb
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:
8461 8306 921 1574 3460 2923 6583 6858 1795 1539 7605 1417 5461 7233 7066 4315 6839 845 9289 6726 3466 490 2105 5324 1205 9636 2789 8628 4388 6411 8208 4608 4400 5574 5856 8447 3162 265 9969 6709 332 3285 5718 3011 3175 3459 3748 6584 4895 1430 7383 1723 8600 2840 9841 4674 501 2571 1452 3074 8807 4...
result:
ok OK (n = 10000, m = 200000)
Test #8:
score: 0
Accepted
time: 2351ms
memory: 219124kb
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:
2544 7352 3772 2629 1583 840 1493 9909 3217 7103 9275 5186 1203 8510 2786 1598 4574 6183 4154 7375 1739 9443 2835 9677 7290 2778 6362 6855 2785 9233 5431 238 5859 1006 47 7871 5283 4641 6592 7721 9424 5989 1110 3408 4858 7623 2907 8155 7534 122 7333 7242 5092 6720 3012 7695 9023 5279 30 2491 3486 19...
result:
ok OK (n = 10000, m = 200000)
Test #9:
score: 0
Accepted
time: 2317ms
memory: 221956kb
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:
1557 4116 4003 6912 6272 6233 6811 6547 4564 4114 1800 7358 9330 1127 6106 7078 4033 7901 5911 9851 4896 254 8744 4243 7600 5782 4028 4497 9815 5137 6154 2191 3174 3861 401 7141 1213 1966 8652 6635 4160 6050 1843 6244 2671 9039 3191 6386 6196 8482 4935 9264 664 3999 3981 4684 1442 3335 4311 9876 876...
result:
ok OK (n = 10000, m = 200000)
Test #10:
score: 0
Accepted
time: 2392ms
memory: 221432kb
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:
8383 7182 6956 9416 8351 1629 4288 3437 2789 4715 3073 4797 7192 4653 2154 269 8160 4849 5049 6653 9551 3806 6484 6467 7710 9767 783 6289 7283 259 2118 2496 4102 8053 2866 9372 7507 4882 2831 6548 762 8453 3578 6390 4663 6689 9026 3207 3435 1956 7835 4205 7512 3410 9966 8456 9501 5790 1765 560 872 9...
result:
ok OK (n = 10000, m = 200000)
Test #11:
score: 0
Accepted
time: 2307ms
memory: 217640kb
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:
7271 4890 6511 3702 2001 2481 3823 1711 3586 5253 9465 9685 4004 8746 5124 754 8708 7915 1581 7778 1389 2827 4287 7121 9337 4515 9594 2033 1932 4776 562 2163 6347 5236 3334 5693 9896 1674 1384 9060 7173 3128 3488 6418 1057 4424 4824 6123 8845 7233 4441 6362 6792 9944 9889 9671 2734 9051 9505 9402 49...
result:
ok OK (n = 10000, m = 200000)
Test #12:
score: 0
Accepted
time: 2421ms
memory: 219076kb
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:
6001 9403 6714 5879 1983 4007 828 9878 3906 6824 7123 428 7354 7156 2117 9895 3704 355 6745 666 8505 2669 3513 4590 1036 960 1587 105 9602 7879 7978 2416 6463 2712 7138 5671 4575 7550 2821 8460 2841 3025 4402 5898 8435 7713 508 4674 762 5575 6415 5593 1176 4482 7205 7267 6386 7436 6806 305 3507 1650...
result:
ok OK (n = 10000, m = 200000)
Test #13:
score: 0
Accepted
time: 2419ms
memory: 221552kb
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:
4479 1922 5321 5283 3962 8883 55 4532 3124 9171 7009 1824 5883 4271 2842 2249 9528 4309 1489 9359 7116 1586 1813 7633 7221 9407 2975 6857 602 9689 5097 9134 1036 1599 1360 6948 2630 3725 2538 4516 2135 2893 1638 1663 8782 3477 1902 7731 3804 1135 2551 9704 2493 5911 6415 8244 9382 6476 1054 4644 773...
result:
ok OK (n = 10000, m = 200000)
Test #14:
score: 0
Accepted
time: 2523ms
memory: 220920kb
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:
9964 8159 5786 7777 5423 9972 9564 1421 3634 5630 9808 1642 1016 2939 1471 7454 2785 9647 7840 226 9581 8421 8329 651 4748 4912 5821 8019 3814 4159 190 2170 7118 1387 8854 2409 1056 5624 2398 7551 3921 4869 1719 2726 5121 5755 6242 4828 9319 6658 4137 2269 9736 3054 5416 9474 2517 8898 5971 3217 961...
result:
ok OK (n = 10000, m = 200000)
Test #15:
score: 0
Accepted
time: 2488ms
memory: 220072kb
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:
9522 280 4999 7850 7802 2801 230 2029 1845 3847 3988 818 3648 3934 943 249 2946 3843 7096 1083 762 1032 6364 222 5485 6983 826 4380 1078 7595 2934 2872 2942 3449 3676 4537 6549 5645 2200 6590 5467 9904 6056 8233 9253 5317 5656 2549 7014 5277 4624 1575 1226 4349 1695 6809 5020 832 9839 2716 4206 3996...
result:
ok OK (n = 10000, m = 200000)
Test #16:
score: 0
Accepted
time: 2544ms
memory: 219400kb
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:
47 7553 4474 7678 4368 2509 4167 4537 5973 9190 6617 7039 9820 6808 7852 8425 1177 7656 7511 4899 2794 1264 594 4505 394 6562 7778 8019 297 5498 2083 2978 233 3412 6332 5346 8757 3686 1431 1839 9746 4064 2386 3960 9281 3801 9982 6657 5161 1172 5584 2561 7898 8311 4317 8169 5721 3892 5529 4397 2904 4...
result:
ok OK (n = 10000, m = 200000)
Test #17:
score: 0
Accepted
time: 2419ms
memory: 218936kb
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:
7835 8343 7098 7004 120 3381 6508 1146 7332 3738 930 7734 6390 2078 3627 6548 4451 7329 3214 2857 2072 8571 4285 9353 9265 7865 6084 3671 7832 2663 1912 801 2536 6896 3851 8304 9003 7354 3280 1626 9428 8097 7511 776 1799 6230 6339 579 6934 7398 2323 7899 5924 2940 9552 7298 3910 5648 1203 7896 3896 ...
result:
ok OK (n = 10000, m = 200000)
Test #18:
score: 0
Accepted
time: 2434ms
memory: 221704kb
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:
2054 7901 8649 9435 621 9719 6327 4032 1063 8861 457 4254 4312 4555 4063 3898 3 1699 5703 4525 9366 1222 2519 2341 7922 5238 7852 3804 6903 8804 9577 3342 8483 3583 9180 3287 1278 5224 5881 4709 2561 7223 7691 9132 8412 4210 3655 1513 7819 1791 2612 270 4269 5161 4812 6201 6150 1313 156 9551 576 844...
result:
ok OK (n = 10000, m = 200000)
Test #19:
score: 0
Accepted
time: 2430ms
memory: 222260kb
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:
6753 9468 9416 3540 955 2127 7604 3171 5460 6711 6337 1186 5658 3720 8482 7464 5298 4868 1067 9426 6534 8856 4091 5857 6190 1138 4037 3990 3012 7978 9714 8689 3565 7883 2049 2212 6237 7160 243 7741 9040 8107 9543 4341 9931 3082 4129 7058 4063 9034 1487 5841 1179 6959 4364 7994 9674 6880 1049 233 312...
result:
ok OK (n = 10000, m = 200000)
Test #20:
score: 0
Accepted
time: 2448ms
memory: 218088kb
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:
2421 4952 2342 7848 6592 4819 5732 3067 2480 5826 1709 8007 3857 5879 6410 5125 7757 2152 6812 6161 1515 1739 8056 7027 511 692 7746 6966 7214 1638 1898 7305 7855 5408 3605 3829 4446 1240 4093 9922 6250 8860 4633 5012 9891 4834 586 4098 425 3878 7286 9453 8009 3896 3877 596 2828 6656 7258 6409 6616 ...
result:
ok OK (n = 10000, m = 200000)
Test #21:
score: 0
Accepted
time: 2379ms
memory: 224016kb
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:
9275 487 1911 8829 8344 9836 2503 5192 3137 7405 5209 3500 5243 2440 5888 7213 9371 5468 7175 6122 6641 9662 930 5848 4941 612 9575 9320 637 7013 4105 7754 6352 1931 2038 3287 9335 389 795 6240 2744 8109 577 8366 8290 6455 8405 8935 8270 252 5376 5381 8793 1370 6935 3242 5743 5401 901 131 4434 8113 ...
result:
ok OK (n = 10000, m = 200000)
Test #22:
score: 0
Accepted
time: 2450ms
memory: 217948kb
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:
3153 26 5334 93 3855 7668 7218 7511 1732 8825 6012 2240 7769 1332 576 9655 8263 8917 8297 7206 1014 7422 4414 961 658 6477 2766 6074 2931 1976 4765 9987 7809 3888 8628 1697 2649 8768 6967 3683 7865 1269 6504 7990 2645 1818 2232 4618 8547 4823 3243 1653 4706 345 5859 6902 8680 6843 4966 6931 6706 225...
result:
ok OK (n = 10000, m = 200000)
Test #23:
score: 0
Accepted
time: 2415ms
memory: 218276kb
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:
766 4873 5356 2533 252 4418 9859 4187 7220 5071 9598 9998 2964 7458 9910 603 2310 132 2214 6508 3921 9890 2724 1321 3754 1051 1354 3724 8955 157 8675 6437 2029 5205 5643 2481 7042 6907 6698 697 7561 50 7044 8508 8441 2821 8237 7112 5619 27 7162 5784 3525 7017 9506 9048 960 7728 5371 5185 7973 6105 8...
result:
ok OK (n = 10000, m = 200000)
Test #24:
score: 0
Accepted
time: 2487ms
memory: 219240kb
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:
6747 3716 1577 9667 2013 2893 7791 6749 2427 7845 5270 6668 1895 3142 3382 7419 4651 3558 2333 2841 8701 2088 1507 6689 5911 2936 4499 8890 9611 1909 2719 7131 4425 5807 2280 6206 3918 2090 6646 6694 573 5906 4329 9625 1554 1270 7199 2818 9207 2642 7955 1521 968 8445 1397 1884 1766 846 5413 851 9057...
result:
ok OK (n = 10000, m = 200000)
Test #25:
score: 0
Accepted
time: 2452ms
memory: 218668kb
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:
7655 3985 1536 2289 1786 8995 7061 6453 8589 6940 9157 9206 9628 1575 4558 9800 3209 3496 4493 5937 974 9371 1594 4973 6018 9910 8849 3099 5874 1424 5611 8910 1703 3706 1934 9018 2382 8655 8182 5687 8823 955 7350 3643 2420 7587 212 8395 438 7851 9088 7163 7489 6589 1140 2886 1984 3016 5299 86 1587 2...
result:
ok OK (n = 10000, m = 200000)
Test #26:
score: 0
Accepted
time: 2501ms
memory: 218216kb
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:
2766 222 137 1303 4941 1359 2504 2290 3832 9355 7251 7143 6280 7017 1719 7423 5604 9229 9986 1692 2574 8728 5788 4724 2069 6783 683 6927 3985 1297 9516 8720 1602 2612 9177 64 8866 8117 4472 587 2460 2299 2940 7323 8846 6756 3629 8889 4705 3617 2001 2874 6606 8793 9567 2625 5764 7955 2821 5329 5371 2...
result:
ok OK (n = 10000, m = 200000)
Test #27:
score: 0
Accepted
time: 2453ms
memory: 223468kb
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:
5506 2520 5835 6879 7152 9596 6547 7307 1271 7332 9867 9680 718 181 734 6523 7119 5775 2410 4834 9929 6321 8476 7578 6329 7404 3647 8805 1778 4999 589 8996 57 131 1716 9550 7085 8955 4543 9799 944 3211 8375 2127 9257 8307 82 7786 8999 7762 1254 7252 1397 7675 5438 186 2330 1525 7344 563 3365 1066 40...
result:
ok OK (n = 10000, m = 200000)
Test #28:
score: 0
Accepted
time: 2603ms
memory: 218172kb
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:
1931 3968 1669 9998 7499 1760 5432 5600 7305 5999 9898 4771 4806 6791 4210 1303 9531 6899 3944 2123 3531 3395 299 9508 4524 5129 1884 2338 6897 5739 8127 6864 4333 3434 1422 6224 7061 7114 7355 1184 1652 4053 5125 5316 3193 2825 7662 7756 8666 9468 580 8836 2896 8787 3326 3226 7330 5637 1257 3351 26...
result:
ok OK (n = 10000, m = 200000)
Test #29:
score: 0
Accepted
time: 2470ms
memory: 221908kb
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:
3514 4321 7707 6415 5814 5158 5836 7554 8366 9706 5003 4910 4547 5168 5958 6928 5188 386 3811 8170 1724 8398 1742 2651 4872 5991 2561 5821 721 1111 890 2789 9382 240 5919 9707 713 8683 8843 5128 5643 3233 2893 345 1770 5300 9215 9456 8730 7020 6511 4907 9131 1246 1829 3657 5856 8583 7128 4388 7683 5...
result:
ok OK (n = 10000, m = 200000)
Test #30:
score: 0
Accepted
time: 2495ms
memory: 218412kb
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:
2620 279 2031 9004 9230 8982 3836 9339 6713 7635 9454 5541 528 228 8180 2284 424 1757 6901 6085 37 3621 4984 4449 3160 1635 5529 7757 9246 9042 4046 2618 3156 2985 6407 1692 4388 4502 9743 9841 6213 7500 9633 7699 6914 2523 9749 8319 8883 4093 3265 6421 4297 8592 4801 2200 1665 3640 8537 2753 4070 2...
result:
ok OK (n = 10000, m = 200000)
Test #31:
score: 0
Accepted
time: 2566ms
memory: 219092kb
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:
2603 9850 2524 665 348 5097 4301 1399 3046 6555 2993 2404 7949 1544 528 7244 4087 6943 4605 3177 8853 2112 6854 2859 6901 3550 317 9541 8660 6276 9366 1489 896 8426 438 3796 1299 2689 4063 8365 9318 3092 4754 9039 5335 1168 8025 3605 6255 3999 7460 2513 7825 4968 663 8429 1730 5526 5767 7368 7817 12...
result:
ok OK (n = 10000, m = 200000)
Extra Test:
score: 0
Extra Test Passed