QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#814199 | #9875. Don't Detect Cycle | ucup-team3161# | WA | 545ms | 13136kb | C++17 | 2.7kb | 2024-12-14 15:55:43 | 2024-12-14 15:55:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define pii pair<int,int>
#define eb emplace_back
const int N=1e5+5;
mt19937_64 rand1;
int T,n,m,_u[N],_v[N],dg[N],ans[N];
bool vse[N];
int fa[N],d[N];
int w1[N];ull w[N],we[N];
vector<ull> z[N];
bool vs[N],tr[N];
vector<pii> e[N];
void dfs(int u,int f)
{
fa[u]=f;
d[u]=d[f]+1;
vs[u]=1;
for(auto [v,id]:e[u])
if(!vse[id] && !vs[v])
tr[id]=1,dfs(v,u);
}
void dfs1(int u,int f)
{
vs[u]=1;
for(auto [v,id]:e[u])
if(!vse[id] && !vs[v])
{
dfs1(v,u);
w[u]^=w[v];
we[u]^=we[v];
w1[u]+=w1[v];
}
}
bool chk(int u,ull w)
{
auto it=lower_bound(z[u].begin(),z[u].end(),w);
if(it==z[u].end() || it+1==z[u].end()) return 0;
return *(it+1)==w;
}
int get()
{
int r=0;
for(int i=1;i<=n;++i) if(dg[i]) {r=i;break;}
fill(tr+1,tr+m+1,0);
fill(vs+1,vs+n+1,0);
dfs(r,0);
fill(w+1,w+n+1,0);
fill(we+1,we+n+1,0);
fill(w1+1,w1+n+1,0);
for(int i=1;i<=m;++i)
if(!vse[i] && !tr[i])
{
int u=_u[i],v=_v[i];
if(!vs[u]) continue;
if(d[u]<d[v]) swap(u,v);
ull t=rand1();
w[u]^=t;
w[fa[v]]^=t;
we[u]^=t;
we[v]^=t;
++w1[u];
--w1[fa[v]];
}
fill(vs+1,vs+n+1,0);
dfs1(r,0);
for(int i=1;i<=n;++i) z[i].clear();
for(int i=1;i<=m;++i)
if(!vse[i] && tr[i])
{
int u=_u[i],v=_v[i];
if(!vs[u]) continue;
if(d[u]<d[v]) swap(u,v);
z[u].eb(we[u]);
z[v].eb(we[u]);
}
for(int i=1;i<=n;++i)
sort(z[i].begin(),z[i].end());
for(int i=1;i<=m;++i) if(!vse[i])
{
int u=_u[i],v=_v[i];
if(!vs[u]) continue;
if(d[u]<d[v]) swap(u,v);
if(w[u]!=w[v]) continue;
if(w1[u]<2 && w1[v]<2) return i;
if(tr[i] && chk(u,we[u]) && chk(v,we[u])) return i;
}
return 0;
}
void slv()
{
scanf("%d %d",&n,&m);
fill(dg+1,dg+m+1,0);
for(int i=1;i<=n;++i) e[i].clear();
for(int i=1,u,v;i<=m;++i)
{
scanf("%d %d",&u,&v);
_u[i]=u;_v[i]=v;
++dg[u];++dg[v];
e[u].eb(v,i);
e[v].eb(u,i);
}
fill(vse+1,vse+m+1,0);
for(int i=m,t;i;--i)
{
t=ans[i]=get();
if(!t) {puts("-1");return;}
vse[t]=1;
--dg[_u[t]];--dg[_v[t]];
}
for(int i=1;i<=m;++i) printf("%d ",ans[i]);
puts("");
}
int main()
{
scanf("%d",&T);
while(T--) slv();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 12872kb
input:
1 4 4 1 2 2 3 3 4 4 2
output:
4 3 1 2
result:
ok Correct
Test #2:
score: 0
Accepted
time: 2ms
memory: 10904kb
input:
4 4 5 1 2 2 3 3 4 3 1 1 4 5 3 1 2 2 3 3 4 9 10 3 5 1 8 5 8 4 9 6 7 7 9 1 2 1 4 2 4 4 6 8 10 1 4 3 8 2 5 3 4 1 5 5 8 2 8 5 7 4 5 3 7
output:
-1 3 2 1 10 9 8 4 2 7 6 5 3 1 -1
result:
ok Correct
Test #3:
score: 0
Accepted
time: 188ms
memory: 12676kb
input:
50 3214 2907 970 1929 2860 3033 1322 2296 931 1192 861 2505 831 2469 231 2549 1 2306 1765 1842 999 3171 177 2007 1798 1894 827 3180 673 1738 1163 1573 2213 2781 2766 3200 1663 2197 1797 2281 315 2637 442 2689 558 2874 1520 2591 651 1923 1133 2920 1747 2412 1104 1528 313 2487 632 3124 660 2182 1581 2...
output:
759 2540 2761 2575 2143 2418 2304 2048 2416 2904 1852 2736 2685 1995 2518 2562 1619 1760 1403 1134 2826 2386 2308 1746 2075 1749 765 575 2318 2150 824 2355 2823 2679 2284 2281 1427 2645 2854 2583 2431 1906 1649 2776 2877 1844 1605 2404 2158 2846 358 2612 2677 2639 2618 1715 2686 2296 1367 2756 2479 ...
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 11436kb
input:
48 732 104 388 425 176 558 7 695 504 507 163 705 204 456 139 432 104 716 535 582 254 682 70 278 77 385 600 680 373 564 197 653 335 569 81 579 339 604 407 580 253 383 480 549 145 308 52 373 426 525 268 359 408 595 47 397 479 569 268 403 477 663 434 660 330 343 56 692 376 450 200 553 299 713 114 584 1...
output:
86 13 85 45 93 68 9 4 96 89 21 28 30 90 67 46 31 24 26 19 76 98 39 84 18 65 42 91 32 78 36 41 102 61 70 95 29 25 104 87 51 1 100 40 10 20 60 62 83 6 77 88 35 15 80 50 59 92 2 58 49 5 64 22 44 81 7 54 47 82 74 34 73 75 55 103 56 94 37 16 38 8 43 52 99 97 69 17 12 11 79 71 33 23 14 63 27 53 72 66 57 1...
result:
ok Correct
Test #5:
score: 0
Accepted
time: 60ms
memory: 12112kb
input:
24 3635 2454 724 2161 994 3233 30 278 2047 3627 693 1048 112 2609 9 1552 889 946 987 2538 923 1911 53 1198 2429 3200 1338 3544 504 2644 1116 3446 815 877 245 3601 2177 3180 212 1638 1140 3241 159 2455 2447 2460 957 1585 980 2338 1254 3014 382 3596 510 595 1408 2300 2053 2276 2177 3415 1051 3353 136 ...
output:
1796 1720 1553 2193 2288 2258 158 1917 2438 1427 821 2421 1896 1914 1083 2033 2323 2061 2001 1674 2440 811 1961 1199 501 2319 1174 1191 1157 1198 184 557 1676 1506 1834 1745 638 1468 2060 1960 2357 1655 2206 2099 2024 1632 2389 2000 1184 2446 2412 1901 1680 1285 1692 2178 1803 1700 871 235 1333 1651...
result:
ok Correct
Test #6:
score: 0
Accepted
time: 37ms
memory: 12548kb
input:
56 2367 1768 132 2148 1280 2214 473 2270 78 2126 374 2080 777 1617 74 152 46 125 36 1136 1340 2010 1536 1801 291 619 610 1567 1688 2303 1005 2308 1101 1988 1695 2257 1056 1405 1134 1579 1819 2281 1281 1952 2065 2102 1984 2353 215 1994 984 2258 1916 2059 1128 2198 966 1048 965 1424 866 932 227 543 33...
output:
935 1560 434 1731 1360 1533 920 1595 941 651 1602 1034 1300 1314 409 1615 803 348 1629 1290 1576 1697 1439 1112 1475 1495 1421 1588 1544 1511 887 1725 286 1530 1422 1750 900 1352 1766 1357 910 853 635 1181 1493 1500 541 739 1284 1204 1767 704 812 1655 1387 1679 1726 1327 1311 1036 1336 1127 1632 148...
result:
ok Correct
Test #7:
score: 0
Accepted
time: 66ms
memory: 11640kb
input:
56 1804 2031 215 520 41 228 505 1449 1202 1467 175 474 583 1684 127 1013 11 1132 251 1009 1333 1516 22 633 168 1160 866 1584 1501 1510 425 1494 563 1764 1341 1646 76 114 541 943 163 166 103 184 455 1225 708 1649 836 1551 551 1381 570 1509 125 221 371 1117 436 1012 392 732 76 379 1040 1359 119 1405 1...
output:
-1 15 9 13 12 10 18 17 14 11 1 16 6 8 7 4 5 3 2 14 8 5 3 7 2 20 18 16 10 13 12 9 6 19 11 1 4 17 15 16 23 25 15 13 7 4 20 2 1 24 22 19 11 21 17 14 12 10 9 5 3 18 8 6 18 16 4 20 19 21 17 8 15 13 1 2 14 12 10 7 6 5 3 11 9 10 19 16 20 12 8 7 1 4 15 13 18 17 14 11 9 6 2 3 5 19 16 18 8 17 20 12 15 14...
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 11996kb
input:
38 17 122 7 11 1 8 2 13 5 6 6 10 9 17 6 13 10 12 2 9 12 14 14 15 3 8 8 12 3 16 3 17 6 16 5 12 4 11 11 16 5 13 5 17 1 4 1 10 8 15 2 16 3 10 6 7 5 7 2 17 10 17 7 12 3 6 9 11 6 17 4 6 9 16 1 16 12 15 7 17 9 10 1 5 10 15 7 10 3 13 1 14 8 14 4 5 4 17 1 17 8 17 7 8 1 2 10 13 11 15 15 16 2 12 2 11 3 7 8 9 ...
output:
-1 -1 -1 -1 -1 15 9 13 12 10 18 17 14 11 1 16 6 8 7 4 5 3 2 14 8 5 3 7 2 20 18 16 10 13 12 9 6 19 11 1 4 17 15 16 23 25 15 13 7 4 20 2 1 24 22 19 11 21 17 14 12 10 9 5 3 18 8 6 18 16 4 20 19 21 17 8 15 13 1 2 14 12 10 7 6 5 3 11 9 10 19 16 20 12 8 7 1 4 15 13 18 17 14 11 9 6 2 3 5 19 16 18 8 17...
result:
ok Correct
Test #9:
score: 0
Accepted
time: 3ms
memory: 11092kb
input:
61 12 66 11 12 5 8 9 12 4 9 2 9 6 12 2 11 1 2 3 6 3 12 6 10 5 6 2 12 10 12 8 12 7 8 7 9 2 8 3 11 3 9 3 10 8 11 2 6 5 12 5 9 4 7 4 5 4 6 5 11 1 3 5 7 1 7 7 10 5 10 6 7 4 12 3 5 4 8 2 3 1 8 6 11 4 11 3 7 1 5 3 4 9 11 1 10 4 10 6 9 7 11 1 4 8 9 10 11 1 11 7 12 1 9 9 10 1 12 6 8 8 10 2 10 2 5 3 8 2 7 1 ...
output:
-1 -1 -1 -1 -1 -1 15 9 13 12 10 18 17 14 11 1 16 6 8 7 4 5 3 2 14 8 5 3 7 2 20 18 16 10 13 12 9 6 19 11 1 4 17 15 16 23 25 15 13 7 4 20 2 1 24 22 19 11 21 17 14 12 10 9 5 3 18 8 6 18 16 4 20 19 21 17 8 15 13 1 2 14 12 10 7 6 5 3 11 9 10 19 16 20 12 8 7 1 4 15 13 18 17 14 11 9 6 2 3 5 19 16 18 8...
result:
ok Correct
Test #10:
score: 0
Accepted
time: 2ms
memory: 12328kb
input:
18 51 1255 24 43 42 51 4 36 29 31 41 42 43 48 10 26 30 40 4 51 25 42 24 42 2 6 3 24 6 21 34 46 5 10 2 37 12 41 19 25 1 2 18 22 1 20 45 49 3 22 14 25 16 25 26 31 25 48 36 45 24 29 34 39 26 29 6 37 18 38 2 51 10 22 15 26 30 33 1 15 10 37 17 33 11 22 28 32 32 39 13 17 21 28 8 23 20 46 8 38 5 44 5 30 4 ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 15 9 13 12 10 18 17 14 11 1 16 6 8 7 4 5 3 2 14 8 5 3 7 2 20 18 16 10 13 12 9 6 19 11 1 4 17 15 16 23 25 15 13 7 4 20 2 1 24 22 19 11 21 17 14 12 10 9 5 3 18 8 6 18 16 4 20 19 21 17 8 15 13 1 2 14 12 10 7 6 5 3 11 9 10 19 16 20 12 8 7 1 4 15 13 18 17 14 11 9 6 2 3 5 19 1...
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 11200kb
input:
61 22 223 1 22 10 22 2 7 19 20 13 17 17 21 18 19 15 16 9 17 5 19 5 8 12 18 4 17 10 20 2 10 4 15 7 11 16 19 5 20 3 14 3 17 7 12 3 21 4 11 17 22 10 17 8 21 9 20 6 11 2 20 5 7 3 18 9 22 13 22 6 14 14 19 5 12 4 22 2 3 14 17 12 16 7 20 5 10 4 7 4 13 1 19 10 13 1 20 13 19 4 6 11 19 3 11 9 14 8 15 3 16 2 8...
output:
-1 -1 -1 -1 -1 -1 -1 15 9 13 12 10 18 17 14 11 1 16 6 8 7 4 5 3 2 14 8 5 3 7 2 20 18 16 10 13 12 9 6 19 11 1 4 17 15 16 23 25 15 13 7 4 20 2 1 24 22 19 11 21 17 14 12 10 9 5 3 18 8 6 18 16 4 20 19 21 17 8 15 13 1 2 14 12 10 7 6 5 3 11 9 10 19 16 20 12 8 7 1 4 15 13 18 17 14 11 9 6 2 3 5 19 16 1...
result:
ok Correct
Test #12:
score: 0
Accepted
time: 536ms
memory: 11752kb
input:
1 4000 4000 1248 3248 260 3260 344 1017 843 3949 451 1483 275 1413 231 3477 264 940 567 1383 1072 3173 830 3445 437 2322 929 1624 1221 2034 3297 3458 1412 1642 837 2505 1918 3259 554 2070 3630 3807 1217 3188 3149 3199 949 1179 2697 3656 802 2039 2496 3757 1073 2857 765 2310 178 3862 1385 2597 1870 2...
output:
3701 1532 2295 3559 3329 3840 3785 3335 3400 464 3415 3921 2286 2762 2384 3870 3908 3996 3724 3829 2538 3550 3656 3636 2076 3717 3066 3510 2451 3731 3004 2203 3028 3779 3393 3871 3832 2271 2993 1776 3551 3087 3257 2786 3431 2325 3662 3687 3539 1072 2906 3593 3987 3327 3101 3389 1008 2524 3819 82 377...
result:
ok Correct
Test #13:
score: 0
Accepted
time: 528ms
memory: 11536kb
input:
1 4000 4000 224 2401 586 2589 379 1471 1805 2518 2145 2874 2310 3019 2487 3160 1729 3934 762 971 2734 3272 2633 2673 846 2606 1047 1755 2907 3577 2329 3026 2121 2725 375 3941 966 3109 30 1389 2721 3284 93 1944 2018 3260 384 2761 2318 3964 2917 3784 123 2934 409 3449 3701 3869 1343 2534 1171 2588 584...
output:
3358 2372 3314 3128 2388 3723 3860 3748 3624 3232 3818 3953 3713 2346 3231 3941 3972 3467 2668 3925 253 1810 2805 3361 3688 3952 3923 2670 3420 3519 3968 3887 3677 3797 2276 3992 3788 2432 3105 2671 713 3781 3777 1317 3829 1687 2312 3977 3174 2487 3455 3370 3858 2398 3878 3643 3899 1625 3841 2600 39...
result:
ok Correct
Test #14:
score: 0
Accepted
time: 545ms
memory: 11588kb
input:
1 4000 4000 2254 2471 2217 2613 3360 3617 152 3820 3226 3879 1688 3423 172 595 2149 2514 2373 3866 456 1567 8 1047 438 2143 1738 2761 219 3396 2476 2574 3209 3535 3572 3903 707 3740 810 1693 1866 3504 199 2163 1085 1137 104 2414 37 1979 3376 3387 1359 1860 816 1070 864 3772 1163 3054 2481 3600 1535 ...
output:
3597 3736 3174 3848 2777 3529 3663 2787 3795 3082 3444 3328 3753 3854 1722 3882 3056 3919 1260 2632 3628 3586 3985 1262 2540 3044 2983 3912 3282 1391 3314 3509 2869 3594 3820 3935 3373 3355 3055 3397 2962 3978 3105 2674 2378 3432 3674 3323 3998 3980 1574 3910 3195 3693 2511 3406 1363 2666 3492 1768 ...
result:
ok Correct
Test #15:
score: 0
Accepted
time: 522ms
memory: 11456kb
input:
1 4000 4000 1391 3587 137 3069 434 3678 630 1365 1721 2147 1885 3917 372 2688 215 1678 2581 2989 628 934 547 838 1835 2960 2265 3755 1393 3277 1906 3593 3053 3131 174 601 2770 3541 855 3399 320 3525 948 3966 3095 3976 560 3642 2417 3751 481 2338 2888 3493 19 3482 270 3754 922 1699 3272 3313 2066 376...
output:
3005 3693 1340 3179 3800 3119 1986 3434 3448 2898 3590 3810 3675 3578 3902 3646 3211 3621 2371 607 3836 3156 3824 2467 3512 3720 3454 2499 1128 3865 2464 1957 2656 3670 3852 3908 2787 3160 3994 3958 3838 3676 382 3493 3930 3562 3385 3685 2813 586 2643 3949 3066 3011 3144 3745 3627 3039 2176 1924 383...
result:
ok Correct
Test #16:
score: 0
Accepted
time: 522ms
memory: 11348kb
input:
1 4000 4000 857 1354 1781 2427 2049 3631 1583 2512 100 839 1824 2596 566 2096 2754 3971 8 3882 1291 1410 2768 2909 2481 3957 153 2599 340 3385 1911 2004 2161 2476 340 3663 44 1333 1034 3119 46 2602 2088 2164 2543 3112 127 2347 1056 1149 1837 2173 1715 3124 2750 3739 1584 1904 2951 3483 665 1963 127 ...
output:
3905 3968 3781 1200 3637 3645 3788 2911 3277 3759 3951 2506 3659 2059 3782 3560 3757 3976 3732 3776 3498 3988 3519 3095 3876 2749 3098 1125 3841 2847 2944 2680 3446 3336 3796 3822 3604 3642 2934 3849 3711 3915 2816 3639 3151 3881 3561 3858 2954 3145 2303 3855 3408 3985 2822 2499 875 3538 3205 3826 3...
result:
ok Correct
Test #17:
score: 0
Accepted
time: 511ms
memory: 11556kb
input:
1 4000 4000 1849 3380 891 1650 1804 1937 3314 3847 124 3415 1489 3545 1000 3552 2600 3390 2047 2407 442 1613 2632 3692 2049 3312 495 589 145 1811 2345 2769 3666 3892 783 3201 584 1116 1406 1953 368 2322 1709 3910 1481 2979 1025 2467 1404 2572 1893 3528 413 518 619 917 111 3212 716 2004 280 793 1219 ...
output:
3675 3240 3624 3222 3888 2541 3400 3133 2391 3956 3993 3616 3453 1430 3825 3669 3879 2093 2935 3796 3431 2841 3246 3348 3709 1879 1325 1881 1117 3578 2502 3863 3667 1708 548 3436 3737 3181 3943 886 3423 3393 3735 3944 2751 3538 3570 2185 3278 2984 3491 3071 3693 1829 1685 3646 3581 2415 3724 3303 37...
result:
ok Correct
Test #18:
score: 0
Accepted
time: 512ms
memory: 11348kb
input:
1 4000 4000 383 1621 1774 3258 129 2251 1694 2640 386 3612 477 1611 434 3737 1413 1920 2054 3773 94 1165 167 2412 1813 2474 2011 2115 2371 3915 229 1651 2553 3489 908 2479 687 2505 2227 3042 219 402 1404 1784 864 1828 798 3431 643 1755 1445 2283 1325 1659 832 1426 3320 3722 48 176 1859 3930 2996 340...
output:
3317 3025 3976 3442 3201 2188 2408 3662 1617 3878 3763 1904 3624 3493 3682 3716 3908 2818 3248 3164 3444 2930 3940 3989 1818 2581 3980 3026 3876 2169 3833 3075 2699 3557 3311 2117 3194 3594 2849 3215 3727 3391 3371 3631 3432 3726 3282 3456 3757 3566 3563 3527 3946 3853 3368 1732 726 2778 2585 1877 3...
result:
ok Correct
Test #19:
score: 0
Accepted
time: 502ms
memory: 12160kb
input:
1 4000 4000 2069 2090 745 803 3546 3918 1002 2097 94 442 158 403 1655 2002 941 1223 1669 3905 2108 2455 2812 3571 430 3214 327 2575 1240 3428 422 1160 914 2219 3 1449 108 3284 2398 3908 555 1207 1924 3504 1472 3187 2360 3247 2174 2420 2753 2758 1536 2813 699 950 2321 3501 1040 3308 159 1706 7 2088 2...
output:
3866 3634 3586 3207 1637 3905 2528 3659 3570 3898 2131 3615 3577 2546 3438 477 3708 3292 353 2356 2601 3936 3791 1703 3945 3116 3034 3495 3433 3964 3914 3935 3788 3846 1618 3005 2430 3407 3808 3507 3837 3661 3942 2952 3989 3498 2714 2801 3214 1298 3587 3381 3284 3101 3086 3208 2938 3973 2822 3916 33...
result:
ok Correct
Test #20:
score: 0
Accepted
time: 515ms
memory: 11280kb
input:
1 4000 4000 1388 3080 144 796 229 2513 1648 3222 2292 3099 1881 2771 1200 1281 2240 2865 1634 2573 2066 2604 464 1615 2711 3961 2851 3143 3102 3567 1621 3707 3536 3568 201 3996 1176 2466 2201 3318 805 3076 1454 1550 2455 3385 2522 3598 1353 2032 1312 1747 1142 3879 404 2183 2276 3828 1592 2571 1993 ...
output:
3920 3401 2256 2524 2452 2053 3978 2858 3445 2656 3923 3240 3982 2574 3419 3311 2025 744 3256 2931 3627 2095 2372 1176 3941 3290 2280 3797 3593 3771 3103 2908 3959 2818 2861 2404 1679 2722 3680 3769 3564 3038 3975 3971 3715 3864 1774 3992 3652 596 3066 3661 3904 3766 2189 3995 3821 3595 3465 1140 15...
result:
ok Correct
Test #21:
score: 0
Accepted
time: 521ms
memory: 12620kb
input:
1 4000 4000 599 1640 57 3563 1764 2956 415 1083 988 2327 2258 3583 1721 2866 117 322 216 1491 2904 3861 1781 3007 1552 2059 1436 2167 2359 2733 1289 1543 929 2422 2529 3473 1494 1536 2483 2735 945 2118 3404 3813 1163 2724 2208 3585 342 2425 609 1888 3412 3825 956 2277 3005 3287 1468 3761 757 3952 12...
output:
1930 2911 3323 3567 955 3027 2938 3975 3694 3910 3504 3713 3742 3273 3430 4000 2398 3602 2818 3577 3868 3064 3964 3240 3526 2165 3936 3941 3706 2110 1470 3758 3735 3441 2915 2023 3421 3628 3560 3555 3912 3856 748 2918 2456 3907 3272 2725 3755 2191 710 3592 3364 3020 3305 3880 3816 2995 1570 3033 252...
result:
ok Correct
Test #22:
score: 0
Accepted
time: 508ms
memory: 11140kb
input:
1 4000 4000 124 2437 1479 1738 2506 3836 336 1763 489 1840 2193 2457 1139 2167 1975 3010 858 2835 763 2778 1474 1959 615 2586 603 2843 105 3410 868 1922 663 2136 286 1999 1705 3905 443 2261 1545 1879 1696 2785 928 1128 1698 3691 517 820 475 2735 1660 1688 1374 1947 16 500 1217 2310 626 3355 825 3368...
output:
3775 3846 3773 3697 3639 3343 3910 1362 3396 3889 3717 3635 3280 2379 3381 3230 3892 3583 3977 3707 3703 3212 3903 1464 2303 3965 3900 3738 3510 3584 3978 3744 3386 2034 3714 3498 3225 3788 3134 3915 457 3390 2637 3985 3057 3292 2900 1911 3756 3913 3718 3207 3848 3571 3196 3562 3546 2191 1384 3994 3...
result:
ok Correct
Test #23:
score: 0
Accepted
time: 535ms
memory: 12552kb
input:
1 4000 4000 2640 2931 781 1781 1356 2326 899 3001 112 3416 2176 3058 1963 2402 3734 3821 929 1637 1184 3733 2286 2423 251 3134 481 3204 652 857 3056 3355 34 1347 1237 2171 116 1048 1313 2773 1638 3625 2602 3486 1984 2942 817 3986 2889 3974 2581 3245 1203 1729 68 673 1879 2976 3598 3695 1428 3062 166...
output:
2739 3979 3819 3901 1819 3743 3124 2354 2635 2585 3069 3546 425 585 3968 3792 3641 3676 3470 3713 3567 3763 2404 3834 3789 2980 3934 2957 3912 2851 3363 3043 3110 1684 3557 2973 3847 818 1372 3918 2630 3941 3415 1299 3292 2625 1832 3761 3527 1579 3871 2888 2751 3357 2052 3749 3577 3172 3644 3603 374...
result:
ok Correct
Test #24:
score: 0
Accepted
time: 540ms
memory: 13136kb
input:
1 4000 4000 2584 3827 1642 3825 1231 1269 1968 3847 2014 3281 1042 2109 3063 3559 2264 2280 1187 2797 1103 3689 2380 3524 1334 3514 2892 2981 60 70 264 3761 97 3633 214 2878 371 2369 878 3044 1916 3642 693 3366 1368 3262 71 1787 919 2662 1897 2838 46 395 1 2677 1051 2591 102 1130 876 3903 706 2657 5...
output:
3790 3502 3531 3192 3997 3349 3884 3029 3866 3248 3920 3227 3998 3135 2604 2491 3526 3684 3652 3763 3936 3887 3458 3942 3802 3825 3962 223 1892 3061 3614 3784 3780 163 3091 3562 3548 3503 3931 3546 3610 3436 3528 3912 3582 3937 2148 2496 3756 3930 3737 1883 2403 3690 2019 3280 2927 1816 3865 3445 36...
result:
ok Correct
Test #25:
score: 0
Accepted
time: 544ms
memory: 11304kb
input:
1 4000 4000 547 2591 286 3922 2196 3068 2578 2917 835 1266 3148 3157 187 2045 872 951 1181 1665 1404 3787 1455 3381 1709 1931 3951 3955 416 992 1498 1591 2757 3441 3740 3906 126 3458 3670 3960 1767 3262 354 3956 316 1176 1407 3778 2319 2762 1125 2344 3083 3477 413 1410 739 2013 1993 3133 1683 2194 2...
output:
3984 2092 2445 3832 2990 3953 2921 2836 2650 2991 3967 3293 3898 2788 3939 2683 2846 3926 2524 3811 1697 2344 3567 3517 3999 3688 3668 3408 2257 1228 2972 3021 3046 3741 3242 3779 3201 2234 1933 2664 3813 3615 1453 1580 2424 1149 976 1320 2024 2487 3529 3985 3538 2149 3114 3302 3441 3439 3604 3466 3...
result:
ok Correct
Test #26:
score: 0
Accepted
time: 524ms
memory: 13092kb
input:
1 4000 4000 1030 1263 132 3186 430 2576 636 3420 1262 3141 599 2920 796 2546 1384 3451 275 1134 788 3228 1933 2752 1862 3696 1946 2286 137 1550 723 1944 1790 3458 2117 3103 905 1318 489 1003 17 1115 704 3506 1028 2129 3108 3154 1765 3098 536 2877 1278 1672 1919 3753 3189 3542 1172 2258 2379 3010 248...
output:
1938 3063 3972 2844 3897 2681 1005 2083 3958 2215 3796 3096 3205 3514 3823 3182 2155 567 3902 3664 2859 3832 3160 972 3226 3747 3783 3814 3616 2715 3887 3034 3687 3819 3185 3255 3287 3889 3590 3882 3785 3052 3975 3826 3991 3709 3417 3957 3679 3948 3291 2341 3530 3390 2489 3503 2524 3970 3541 3044 32...
result:
ok Correct
Test #27:
score: 0
Accepted
time: 503ms
memory: 11396kb
input:
1 4000 4000 183 1656 21 2247 1518 1680 2834 3783 156 1065 557 1358 759 1845 1390 2208 191 1559 546 3980 1892 3508 1239 1251 2735 3088 305 644 2642 3483 708 1799 748 1634 601 1141 736 1413 640 2977 698 1568 2266 3837 2705 3388 512 2528 18 3087 484 1959 2547 3604 3178 3542 396 2064 324 3070 1616 3693 ...
output:
3521 3647 2258 3909 3397 238 2982 3004 1958 3837 3623 3081 3947 1886 1800 2908 3790 389 3215 3477 3750 3300 2494 3261 3675 3585 1446 3251 3712 3905 3473 3913 3033 3663 3445 3314 3322 3741 2321 2935 3616 3723 2181 3902 3439 3401 3381 3512 2796 2236 3604 3176 2577 3434 3963 3860 2951 1294 3460 3787 38...
result:
ok Correct
Test #28:
score: 0
Accepted
time: 508ms
memory: 12168kb
input:
1 4000 4000 567 2891 2734 2894 2315 3205 293 3742 1306 3744 186 2629 2544 3454 566 3863 2489 2670 886 1213 1771 3242 4 2136 1384 3689 1974 3078 336 1482 471 2301 2553 3063 1640 2046 3020 3456 2164 3972 2294 2646 554 3475 1960 2990 89 1020 563 2120 973 1827 149 2943 2158 2858 982 3543 995 3049 498 34...
output:
3821 2620 1791 3475 2480 3090 3927 3808 3917 1946 3433 3190 2766 3509 3790 2932 3659 2676 3218 3812 2880 3340 2669 3738 2894 3317 3307 3950 1282 3202 3167 3943 3258 3142 3124 2755 2276 3928 3972 3571 3141 3114 1846 3668 1278 2470 3981 3751 3909 1788 1112 3867 3253 3342 2740 2312 3761 2972 3536 1527 ...
result:
ok Correct
Test #29:
score: 0
Accepted
time: 512ms
memory: 12756kb
input:
1 4000 4000 73 1104 1963 3399 1916 3595 1759 1941 1144 2204 861 3316 1415 2794 260 3545 411 428 1137 1416 2280 3214 127 2192 2793 3102 2048 2157 933 3017 1500 2353 513 3976 892 3236 2269 2434 532 2551 2927 3537 229 2810 2457 3568 1891 2380 2514 3483 1915 2167 2501 3286 346 1808 3181 3903 383 2516 15...
output:
3254 937 2933 2214 3218 3346 3764 1764 3882 1219 3980 3459 3575 3304 3954 3902 3732 2076 3571 3263 3557 3145 601 138 3624 2307 1889 3151 3968 3016 1427 3004 3629 3466 3146 3156 3756 3233 2926 2381 3397 3510 3794 3639 3833 3479 3267 3728 3807 3743 3953 3450 2889 3934 3659 3175 3615 1956 2574 2793 378...
result:
ok Correct
Test #30:
score: 0
Accepted
time: 534ms
memory: 12576kb
input:
1 4000 4000 82 3284 1814 2006 1618 2435 57 2861 232 2959 169 2668 1718 2748 506 3604 2148 2231 3110 3993 3589 3875 1690 3387 256 3376 1067 1531 43 3211 2724 3985 675 3128 323 701 50 1754 251 2459 3086 3775 3328 3506 1158 2762 1870 3879 467 1410 1044 2314 2381 2485 957 1432 693 1700 75 1656 34 2290 1...
output:
3891 3888 1207 3640 3431 3458 2586 2862 2442 3684 3661 3777 2983 2922 3737 2521 2060 2003 1891 3976 3393 2246 1504 3889 1515 3841 3250 3678 3862 3504 3448 3837 3310 3732 3706 3764 3935 1379 2763 2727 2806 3942 3903 3962 3061 3811 3988 3941 2871 3679 3853 3027 3610 3831 3079 3214 3343 3392 3964 3883 ...
result:
ok Correct
Test #31:
score: 0
Accepted
time: 515ms
memory: 11144kb
input:
1 4000 4000 1837 3254 678 3631 2009 3325 2084 2160 954 1704 266 3555 1857 1923 1584 3192 1855 3080 978 3030 1513 2113 1085 1279 2186 2256 359 2276 245 416 2087 2172 1561 3688 2495 3233 894 1710 2337 2866 1150 2428 481 1172 2668 3079 2440 2745 3362 3935 2470 3359 2890 3602 2681 2940 2033 3792 2995 39...
output:
3816 3624 3793 3368 2478 3572 3503 3605 3809 3546 3978 3708 1078 3690 1364 3682 2524 3767 1754 3596 2843 2681 1726 3671 3009 3308 2130 2905 2557 3841 3800 3850 2992 2842 3619 3677 3966 3661 3672 2403 2087 1230 3727 3177 3048 3787 3878 3509 3823 3569 3750 3862 3973 3901 3688 2573 1792 3829 3508 3514 ...
result:
ok Correct
Test #32:
score: 0
Accepted
time: 496ms
memory: 12380kb
input:
1 4000 4000 2666 2788 1806 3099 799 2195 252 2483 1011 1837 1177 1351 754 2378 386 2651 2444 3234 1836 3950 1718 3367 2171 3630 1177 2162 2017 2708 2226 2308 2022 2183 1004 1086 944 2510 669 3126 545 731 253 3292 2218 2491 2695 2948 1009 3866 247 3119 1497 3806 1061 3704 648 2105 1349 2085 2566 3245...
output:
1089 3047 3755 3695 3638 3320 3204 3217 3479 2461 2528 2165 3133 3544 2743 3833 1261 3981 2312 3789 542 1798 3956 3979 3971 3409 1475 3781 3207 3554 2603 873 3129 3354 3534 3823 3648 3746 3546 3934 3665 3965 3788 3348 1390 3227 3914 1971 2430 3088 3485 3257 2596 2717 2788 3751 3366 3866 2884 3583 16...
result:
ok Correct
Test #33:
score: -100
Wrong Answer
time: 0ms
memory: 11200kb
input:
70 2 1 1 2 3 1 1 2 3 1 1 3 3 2 1 2 1 3 3 1 2 3 3 2 1 2 2 3 3 2 1 3 2 3 3 3 1 2 1 3 2 3 4 1 1 2 4 1 1 3 4 2 1 2 1 3 4 1 1 4 4 2 1 2 1 4 4 2 1 3 1 4 4 3 1 2 1 3 1 4 4 1 2 3 4 2 1 2 2 3 4 2 1 3 2 3 4 3 1 2 1 3 2 3 4 2 1 4 2 3 4 3 1 2 1 4 2 3 4 3 1 3 1 4 2 3 4 4 1 2 1 3 1 4 2 3 4 1 2 4 4 2 1 2 2 4 4 2 1...
output:
1 1 1 2 1 1 2 1 2 1 3 2 1 1 1 2 1 1 2 1 2 1 3 2 1 1 2 1 2 1 3 2 1 2 1 3 2 1 3 2 1 4 3 2 1 1 2 1 2 1 3 2 1 2 1 3 2 1 3 2 1 4 3 2 1 2 1 3 2 1 3 2 1 4 3 2 1 3 2 1 4 3 2 1 4 3 2 1 -1 -1 2 1 2 1 3 2 1 2 1 3 2 1 3 2 1 4 3 1 2 2 1 3 2 1 3 2 1 4 3 2 1 3 2 1 ...
result:
wrong answer Wrong - you can add all edges, but found: -1