QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#326604 | #6312. 城市建造 | ushg8877 | 0 | 197ms | 21232kb | C++20 | 1.3kb | 2024-02-13 16:05:11 | 2024-02-13 16:05:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
const int MAXN=1e5+5;
int n,m,k,tot;
vector<int> edg[MAXN],grp[MAXN<<1];
int dfn[MAXN],low[MAXN],st[MAXN],top,cnt;
int siz[MAXN<<1];
void tarjan(int u){
st[++top]=u;dfn[u]=low[u]=++cnt;
for(int v:edg[u]){
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
if(low[v]>=dfn[u]){
tot++;
auto add=[&](int u){
grp[u].push_back(tot);
grp[tot].push_back(u);
};
add(u);
while(st[top+1]!=v) add(st[top--]);
}
}else low[u]=min(low[u],dfn[v]);
}
}
void dfs(int u,int fa,int lim){
siz[u]=(u<=n);
for(int v:grp[u]) if(v!=fa){
dfs(v,u,lim);
siz[u]+=siz[v];
}
if(u<=n&&siz[u]==lim) siz[u]=0,cnt++;
}
void solve_0(){
int ans=0;
for(int i=1;i<n;i++) if(n%i==0){
cnt=0;
dfs(1,0,i);
ans+=(cnt>=n/i);
if(cnt==n/i) cout<<i<<endl;
}
cout<<ans<<endl;
}
void solve_1(){
}
int main(){
ios::sync_with_stdio(false);
// freopen("ex_cities2.in","r",stdin);
cin>>n>>m>>k;tot=n;
for(int i=1;i<=m;i++){
int u,v;cin>>u>>v;
edg[u].push_back(v);
edg[v].push_back(u);
}
tarjan(1);
for(int i=1;i<=n;i++) for(int j:grp[i]) cout<<i<<' '<<j<<endl;
if(k==0) solve_0();
else solve_1();
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3688kb
input:
15 20 0 2 7 14 7 11 12 15 9 6 2 11 4 5 10 15 7 8 4 12 5 10 1 14 4 6 8 8 15 7 14 10 14 2 6 13 10 7 13 8 3
output:
1 19 2 18 3 17 4 18 5 18 6 18 7 18 8 17 8 18 9 16 10 18 10 19 11 18 12 18 13 18 14 18 15 16 15 18 1 1
result:
wrong answer Output contains longer sequence [length = 38], but answer contains 1 elements
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3668kb
input:
15 20 0 1 14 5 12 6 1 5 12 9 2 11 10 6 9 11 7 15 3 1 10 8 1 10 15 13 8 3 11 15 11 1 2 8 12 13 4 10 11 4 5
output:
1 16 1 17 1 20 1 22 2 17 3 19 4 21 5 21 6 17 7 18 8 21 8 22 9 17 10 19 10 20 11 18 11 19 12 21 13 21 14 16 15 19 1 5 2
result:
wrong answer 1st numbers differ - expected: '2', found: '1'
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3780kb
input:
20 50 1 11 19 16 2 5 1 15 2 14 16 16 14 16 20 6 7 8 7 19 15 8 7 20 12 14 18 2 15 15 19 4 3 1 8 16 12 18 14 3 9 7 8 13 2 9 17 15 11 4 10 12 20 7 8 8 7 7 8 4 3 8 6 6 8 15 19 2 13 9 17 3 16 8 1 7 8 3 9 3 10 5 1 8 1 5 1 5 1 13 2 7 6 15 19 3 8 3 4 4 10
output:
1 21 1 35 2 27 2 28 2 29 3 23 3 25 3 33 3 34 4 23 5 21 6 22 7 22 8 22 8 34 8 35 9 24 9 25 10 23 11 26 12 32 13 28 14 30 14 31 15 26 15 27 16 29 16 31 16 32 16 33 17 24 18 30 19 26 20 32
result:
wrong answer 1st numbers differ - expected: '19', found: '1'
Test #4:
score: 0
Wrong Answer
time: 1ms
memory: 3784kb
input:
20 50 1 14 9 20 10 6 19 20 4 11 19 12 2 20 4 14 9 17 9 3 7 9 13 2 3 3 7 19 13 8 15 11 13 14 1 9 5 17 10 9 16 2 12 6 13 2 12 10 17 8 15 18 14 13 6 6 13 9 17 3 7 17 7 6 19 8 7 14 18 9 5 11 13 11 13 2 3 19 13 7 17 9 16 8 7 13 9 11 6 7 8 17 4 5 16 9 17 11 13 7 15
output:
1 33 2 22 2 23 3 23 3 24 4 21 5 30 6 28 7 24 7 25 7 26 8 25 9 27 9 29 9 30 9 31 10 21 11 28 12 22 13 28 13 29 14 31 14 32 14 33 15 25 16 30 17 21 17 26 17 27 18 32 19 28 20 21
result:
wrong answer 1st numbers differ - expected: '8', found: '1'
Test #5:
score: 0
Wrong Answer
time: 1ms
memory: 3696kb
input:
20 50 1 8 17 19 7 19 12 13 3 17 11 13 11 19 7 2 12 17 7 12 7 18 14 9 14 18 16 7 13 8 1 11 13 3 13 12 7 9 16 17 13 3 15 16 9 4 15 11 10 7 17 18 14 20 1 15 13 18 9 11 7 10 6 20 1 17 20 14 16 13 16 20 1 3 15 10 6 1 8 13 16 13 17 16 9 6 10 7 19 12 2 5 6 1 17 15 4 16 7 7 17
output:
1 30 2 23 3 22 4 21 5 26 6 26 6 27 7 24 7 29 8 30 9 25 10 27 10 28 11 28 11 29 12 23 12 24 13 22 13 29 14 25 15 21 15 22 16 25 16 29 17 29 17 30 18 25 19 24 20 30
result:
wrong answer 1st numbers differ - expected: '9', found: '1'
Test #6:
score: 0
Wrong Answer
time: 1ms
memory: 3868kb
input:
200 300 0 35 199 36 155 149 132 176 127 49 2 193 70 103 56 148 152 38 128 2 37 148 7 122 67 19 134 103 19 76 118 52 54 159 51 130 122 107 196 63 172 71 42 174 33 66 170 51 100 102 92 53 106 77 135 103 134 9 52 164 140 185 13 116 138 6 70 69 178 198 23 146 74 87 101 68 194 144 69 105 163 71 78 56 65 ...
output:
1 209 1 250 2 230 3 247 4 230 5 226 6 236 7 221 8 226 9 221 10 221 11 236 12 248 12 249 13 212 13 214 14 236 15 232 16 226 17 226 18 230 19 226 20 230 21 236 22 241 23 221 24 220 24 221 25 232 26 236 27 232 28 240 29 231 29 237 29 242 29 243 30 226 31 238 32 250 33 214 34 214 35 241 36 204 36 205 36...
result:
wrong answer 1st numbers differ - expected: '4', found: '1'
Test #7:
score: 0
Wrong Answer
time: 2ms
memory: 5700kb
input:
200 300 0 73 128 63 135 186 29 47 95 68 164 145 2 112 171 190 83 82 186 191 124 29 14 104 75 58 133 135 63 39 136 143 181 105 182 174 150 17 193 84 9 143 102 67 182 12 124 99 179 28 107 198 188 63 26 91 94 135 63 54 74 137 150 84 199 18 135 156 88 34 13 200 157 114 156 196 118 81 116 23 10 197 169 1...
output:
1 203 1 329 2 214 2 215 2 220 2 224 2 225 3 243 4 288 5 204 6 262 6 263 7 315 7 319 7 320 8 265 8 266 9 305 10 243 10 252 11 209 11 210 12 255 13 244 13 245 13 246 14 303 15 313 15 314 16 206 17 208 18 268 18 273 19 296 20 301 21 213 22 294 23 243 24 229 24 230 25 207 25 325 25 327 25 328 26 261 26 ...
result:
wrong answer 1st numbers differ - expected: '3', found: '1'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 4128kb
input:
2000 1999 1 465 582 845 1459 282 1900 537 152 150 257 1108 710 1144 1451 1262 815 1566 1262 761 439 1265 198 1419 15 480 294 1054 1251 234 367 850 90 344 67 1229 180 1454 1844 1323 1008 1982 348 96 1282 585 919 939 1210 360 437 807 1 757 1533 425 238 138 685 1808 1066 1683 1001 1566 569 1184 1737 11...
output:
1 3999 2 3386 2 3387 3 2066 4 3991 4 3992 5 2721 5 2722 6 2306 6 2307 7 2764 7 2765 8 2823 9 3529 9 3530 9 3531 9 3532 10 2237 11 2819 11 2820 11 2825 11 2861 11 2862 12 3709 13 3695 14 2382 15 2772 15 2773 16 2619 17 2654 17 2655 18 3828 18 3832 18 3833 19 2873 19 2895 19 2896 19 2901 19 2902 20 24...
result:
wrong answer 1st numbers differ - expected: '116891230', found: '1'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 6116kb
input:
2000 1999 1 540 1725 1919 242 627 762 695 1264 1377 1351 309 1749 1596 1297 983 1053 260 949 1218 1403 1144 1066 478 1515 1834 688 1525 480 1660 51 374 1207 878 335 833 217 1347 1429 1093 1477 1597 691 803 1081 1059 729 1225 1948 398 1071 1266 1578 1138 631 409 466 1105 1889 57 408 1356 123 1164 104...
output:
1 3999 2 3479 3 3159 3 3160 4 3843 5 3928 5 3929 6 2130 7 3249 8 2297 8 2298 9 3445 9 3451 9 3452 10 3353 10 3354 11 2487 11 2488 12 2133 13 3933 13 3934 14 2388 15 3828 15 3829 16 2094 16 2096 16 2098 16 2099 17 3167 17 3168 18 3949 18 3950 19 3931 20 3609 20 3610 21 3668 21 3670 21 3671 22 2450 22...
result:
wrong answer 1st numbers differ - expected: '715143401', found: '1'
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 6064kb
input:
2000 3000 0 1642 694 947 9 706 385 1 1618 1844 402 442 309 1802 734 333 197 1194 1204 373 1123 891 1281 1907 449 1093 1612 1316 1178 1407 841 708 279 1542 1703 885 1900 1658 971 1493 1908 1299 485 1510 1050 644 958 414 1187 869 1250 1167 495 966 1935 932 468 1769 1260 1040 804 549 1487 620 775 1857 ...
output:
1 3343 1 3344 1 3345 2 2770 3 3115 3 3116 4 2022 5 2914 5 2916 6 3237 6 3238 6 3239 7 2280 7 2281 8 2874 8 2875 8 2876 8 2879 8 2880 9 2368 10 2458 11 2351 11 2352 12 2258 13 3282 14 3170 15 2922 15 2923 15 2924 16 2006 16 2009 16 2010 17 2680 17 2681 18 2996 18 3000 18 3001 19 2152 20 2600 20 2603 ...
result:
wrong answer 1st numbers differ - expected: '4', found: '1'
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3928kb
input:
2000 3000 0 408 1484 1521 1118 1045 1938 1090 1897 1432 529 647 1015 1320 1655 1909 1873 1323 989 478 1778 1934 1145 963 1949 871 1716 829 1605 139 860 1757 232 45 1321 1197 627 1634 1366 47 1576 691 1413 1920 252 1366 419 1431 525 439 842 22 1848 536 1479 350 334 663 1412 170 1666 749 1794 149 957 ...
output:
1 2383 2 2341 3 2120 4 2121 5 2280 6 2023 7 2103 8 2262 9 2175 10 2014 10 2015 11 2023 12 2103 13 2112 14 2066 15 2017 16 2332 16 2341 17 2043 18 2023 19 2369 20 2341 21 2318 22 2066 23 2121 24 2268 24 2269 25 2318 26 2006 26 2023 27 2066 28 2103 29 2023 30 2276 31 2103 32 2318 33 2322 34 2369 35 20...
result:
wrong answer 1st numbers differ - expected: '5', found: '1'
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3964kb
input:
2000 3000 1 1042 636 1347 1373 16 1538 405 377 1353 1413 139 221 1448 26 797 822 811 880 1380 976 1999 144 1392 1240 1161 886 1740 817 460 263 1519 926 1491 1776 660 1177 1143 702 1377 1526 771 784 893 536 1725 1581 623 584 960 9 1744 1680 1399 351 1975 1290 177 832 1465 1858 541 310 15 369 208 600 ...
output:
1 3464 1 3466 2 2355 3 2173 3 2179 3 2180 4 3086 5 2294 6 2617 6 2626 6 2717 7 2620 8 3447 9 3088 9 3089 10 3408 11 3107 11 3111 12 3293 12 3294 13 2362 14 2899 14 2919 14 2932 14 3013 15 2959 15 2960 15 2961 16 2382 17 2368 18 3360 19 3171 20 2600 21 2734 21 2736 21 2738 22 2035 22 2036 22 2043 23 ...
result:
wrong answer 1st numbers differ - expected: '851964567', found: '1'
Test #13:
score: 0
Wrong Answer
time: 5ms
memory: 4140kb
input:
2000 3000 1 399 842 1957 1476 1284 1494 109 1498 1714 1156 533 1573 59 884 1961 1142 600 1179 1557 1380 1468 1541 396 1343 252 629 914 1408 1867 1793 770 1459 1797 1870 1696 282 541 869 1173 1065 980 991 289 1995 765 1343 628 1487 1229 111 555 686 1142 1309 642 1731 809 1498 1828 1134 1954 1151 1768...
output:
1 2948 2 2776 3 2849 3 2850 4 2195 5 2748 5 2763 6 2711 6 2712 7 2850 8 2240 8 2242 9 2829 10 2851 10 2854 10 2855 10 2856 11 2210 12 2495 13 2049 14 2279 14 2280 15 2815 16 2079 16 2080 17 2848 17 2850 18 2300 18 2301 19 2720 20 2547 21 2857 21 2887 22 2566 23 2163 23 2165 24 2520 24 2521 25 2503 2...
result:
wrong answer 1st numbers differ - expected: '596182037', found: '1'
Test #14:
score: 0
Wrong Answer
time: 75ms
memory: 21232kb
input:
100000 99999 1 51817 26399 15817 96313 49906 51230 78680 242 31802 66868 30357 78985 12525 6836 21594 17217 51918 70113 34779 36388 39346 27341 23790 83913 67772 74306 79030 8675 13297 48602 31050 35041 88425 8465 2567 50848 32581 25543 17562 66633 50079 89402 21395 31562 82946 75355 36292 48542 178...
output:
1 199997 1 199999 2 159324 3 156203 4 199148 5 102966 5 102967 6 195526 6 195527 6 195528 7 136920 8 135733 8 135735 8 135736 9 164413 9 164415 9 164416 10 162521 10 162522 11 104664 11 104665 11 104666 12 145647 12 145648 13 134107 13 134108 13 134109 14 193011 14 193012 15 108221 15 108222 16 1122...
result:
wrong answer 1st numbers differ - expected: '213549735', found: '1'
Test #15:
score: 0
Wrong Answer
time: 116ms
memory: 21036kb
input:
100000 99999 1 36876 91 57635 85878 73848 6445 56560 31152 92050 83033 84343 84735 19344 59385 16031 82742 24733 35911 28824 52694 89526 7696 47243 72123 7605 41706 40153 16549 117 72375 94514 57348 31759 46680 31370 59666 4180 17810 8025 44622 21906 56373 33740 12923 25841 43798 45198 88125 99159 9...
output:
1 199985 1 199986 1 199999 2 121115 2 121116 3 159091 4 110914 5 144137 6 180464 6 180465 6 180466 7 178444 7 178446 7 178447 8 132998 8 132999 9 174554 10 130377 10 130379 10 130380 11 117469 11 117470 12 150412 12 150416 12 150417 13 147508 14 185384 14 185385 14 185386 15 131984 15 131985 16 1149...
result:
wrong answer 1st numbers differ - expected: '697917401', found: '1'
Test #16:
score: 0
Wrong Answer
time: 197ms
memory: 19400kb
input:
100000 200000 0 73311 26692 47112 50996 80957 18065 55469 44726 18171 14114 1652 41393 33535 58668 10619 90228 62378 80677 78580 22495 20629 89185 98877 21979 36123 37841 20762 58459 28399 29048 94059 29696 88568 84814 57216 16617 48405 54760 1772 58208 78839 23779 56785 90360 71929 74555 89985 4599...
output:
1 100001 1 145433 2 143373 3 108303 4 106107 5 141147 6 119407 7 108479 8 130696 9 139746 10 115088 10 115089 11 115609 12 127072 12 127081 13 115164 14 105780 15 106948 15 106949 16 121172 17 141194 18 135706 18 135707 19 104607 20 141515 21 131515 21 131516 21 131517 22 139451 22 139464 23 135879 ...
result:
wrong answer 1st numbers differ - expected: '7', found: '1'
Test #17:
score: 0
Wrong Answer
time: 105ms
memory: 17352kb
input:
100000 200000 0 74724 58001 2096 36434 10780 66175 8075 91461 98543 76912 91080 58166 91369 63734 86609 37092 76236 17518 27092 86029 49327 96255 55749 32047 59513 4477 21883 24851 12313 11034 58127 78948 38744 21465 52775 15415 26264 19640 80625 57520 96868 34807 46432 91667 34092 71798 48442 53707...
output:
1 107963 1 107964 2 100565 2 100567 3 101930 4 103016 5 104997 6 105289 7 106435 8 103138 9 101296 10 101370 11 100500 11 100501 12 105901 13 100070 14 107856 15 105202 16 102128 17 106851 18 106971 19 101447 20 103904 21 101969 22 103666 23 101617 24 104008 25 100521 26 107520 27 107933 28 104497 2...
result:
wrong answer 1st numbers differ - expected: '4', found: '1'
Test #18:
score: 0
Wrong Answer
time: 84ms
memory: 19984kb
input:
100000 200000 1 41399 84309 59315 57604 76994 41146 89914 5576 10071 2828 40663 32009 8115 72560 15544 30127 75408 15716 13752 40186 49595 42893 93363 66913 35917 59205 4350 58352 84832 39487 93821 1026 52401 33617 90465 3287 16829 33543 86825 73171 69299 16118 35588 53961 58170 44730 50174 71526 44...
output:
1 156252 1 156253 2 127550 3 133807 3 133894 4 138279 4 138280 5 108970 5 109042 6 141239 7 138569 7 138662 8 134903 8 135076 9 104995 9 104996 9 105110 10 124819 11 105852 11 105853 12 106734 12 106773 12 106881 13 142436 13 142437 13 142614 14 122797 14 122885 15 119792 15 119917 16 118728 16 1187...
result:
wrong answer 1st numbers differ - expected: '507071456', found: '1'
Test #19:
score: 0
Wrong Answer
time: 105ms
memory: 19604kb
input:
100000 200000 1 61682 10243 91643 23294 5766 66088 44830 3952 93132 17701 5776 2236 76832 71195 38033 22975 40375 14419 97543 53348 62755 10220 47663 55955 40946 33673 56759 68401 88580 110 62264 25662 214 77675 36373 6940 28023 41926 81352 23162 72657 86572 25487 97838 70762 3628 23027 37780 36529 ...
output:
1 151391 2 137282 2 137287 3 102179 3 102186 4 127301 4 127306 5 106723 5 106738 6 119416 7 134379 8 149927 8 149928 9 126569 9 126577 10 138639 10 138647 11 136529 12 145400 12 145414 13 132388 14 140428 15 144125 15 144136 16 150158 17 151047 18 127781 18 127793 19 120431 20 103100 20 103106 21 12...
result:
wrong answer 1st numbers differ - expected: '367083003', found: '1'
Test #20:
score: 0
Wrong Answer
time: 99ms
memory: 19268kb
input:
100000 200000 1 83161 92368 783 10781 95621 57345 93279 74412 96084 29764 83839 59585 68295 38546 18951 68761 30461 32813 95888 94000 71796 53643 24398 22834 85633 84908 37566 53874 35140 67126 24519 82526 97616 83915 65640 11899 53812 97833 44761 28536 65548 37212 91762 5827 73676 56073 46769 95173...
output:
1 157360 2 156523 3 120415 4 113189 4 113191 4 113192 4 113193 5 130927 6 138591 6 138592 7 110797 8 132307 9 104898 10 144219 10 144223 11 142360 11 142361 12 103798 13 128397 14 150376 15 114024 16 156100 17 121034 17 121035 18 123809 19 151051 19 151052 20 132011 21 118864 21 118894 21 118896 21 ...
result:
wrong answer 1st numbers differ - expected: '692564509', found: '1'