QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#151658 | #6329. Colorful Graph | Forever_Young# | AC ✓ | 807ms | 6556kb | C++14 | 4.1kb | 2023-08-27 13:10:18 | 2023-08-27 13:10:18 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;++i)
#define per(i,n) for(int i=n;i>=1;--i)
#define pb push_back
#define mp make_pair
#define stack stck
#define N 7010
#define M 7100
#define inf 1000000007
struct EDGE { int adj, next; } edge[M];
int n, m, top, gh[N];
int dfn[N], low[N], cnt, ind, stop, instack[N], stack[N], belong[N];
void addedge(int x, int y) {
edge[++top].adj = y;
edge[top].next = gh[x];
gh[x] = top;
}
void tarjan(int x) {
dfn[x] = low[x] = ++ind;
instack[x] = 1; stack[++stop] = x;
for (int p=gh[x]; p; p=edge[p].next)
if (!dfn[edge[p].adj]) {
tarjan(edge[p].adj);
low[x] = min(low[x], low[edge[p].adj]);
} else if (instack[edge[p].adj]) {
low[x] = min(low[x], dfn[edge[p].adj]);
}
if (dfn[x] == low[x]) {
++cnt; int tmp=0;
while (tmp!=x) {
tmp = stack[stop--];
belong[tmp] = cnt;
instack[tmp] = 0;
}
}
}
pair<int,int> save[M];
set<pair<int,int> > dic; //duplicate edges
namespace flow
{
struct EDGE { int adj, w, cap, next; } edge[10*M];
int n, top, gh[2*N], nrl[2*N] , S, T;
void addedge(int x, int y, int w) {
//cout<<"fuck: "<<x<<" "<<y<<" "<<w<<endl;
edge[++top].adj = y;
edge[top].w = w;
edge[top].cap=w;
edge[top].next = gh[x];
gh[x] = top;
edge[++top].adj = x;
edge[top].w = 0;
edge[top].cap=0;
edge[top].next = gh[y];
gh[y] = top;
}
int dist[2*N], q[2*N];
int bfs() {
memset(dist, 0, sizeof(dist));
q[1] = S; int head = 0, tail = 1; dist[S] = 1;
while (head != tail) {
int x = q[++head];
for (int p=gh[x]; p; p=edge[p].next)
if (edge[p].w && !dist[edge[p].adj]) {
dist[edge[p].adj] = dist[x] + 1;
q[++tail] = edge[p].adj;
}
}
return dist[T];
}
int dinic(int x, int delta) {
if (x==T) return delta;
for (int& p=nrl[x]; p && delta; p=edge[p].next)
if (edge[p].w && dist[x]+1 == dist[edge[p].adj]) {
int dd = dinic(edge[p].adj, min(delta, edge[p].w));
if (!dd) continue;
edge[p].w -= dd;
edge[p^1].w += dd;
return dd;
}
return 0;
}
int work() {
int ans = 0;
while (bfs()) {
memcpy(nrl, gh, sizeof(gh));
int t; while (t = dinic(S, 2147483647)) ans += t;
}
return ans;
}
}
int col[N],nxt[N],du[N];
int flowedge[M];
vector<pair<int,int> > G[2*N];
vector<int> le,ri;
void dfs(int x)
{
while (!G[x].empty())
{
int i=G[x].size()-1;
G[x][i].second--;
int y=G[x][i].first;
if (G[x][i].second==0)G[x].pop_back();
if (x==flow::S)le.pb(y);
if (y==flow::T)ri.pb(x);
dfs(y);
return;
}
}
int main()
{
//freopen("1.in","r",stdin);
cin>>n>>m;
rep(i,m)
{
scanf("%d%d",&save[i].first,&save[i].second);
addedge(save[i].first,save[i].second);
}
//SCC
rep(i,n)if (!dfn[i])tarjan(i);
//Flow
flow::top=1;
flow::S=0;
flow::T=2*cnt+1;
rep(i,cnt)
{
flow::addedge(flow::S,i,1);
flow::addedge(cnt+i,i,inf);
flow::addedge(cnt+i,flow::T,1);
}
dic.clear();
rep(i,m)flowedge[i]=-1;
rep(i,m)
if (belong[save[i].first]!=belong[save[i].second])
{
int x=belong[save[i].first];
int y=belong[save[i].second];
if (dic.find(mp(x,y))!=dic.end())continue;
dic.insert(mp(x,y));
flow::addedge(x,cnt+y,inf);
flowedge[i]=flow::top;
}
int f=flow::work(); //cout<<f<<endl;
for(int i=flow::S;i<=flow::T;i++)
for(int p=flow::gh[i];p;p=flow::edge[p].next)
if (flow::edge[p].cap)
{
if (flow::edge[p].cap==flow::edge[p].w)continue;
G[i].pb(mp(flow::edge[p].adj,flow::edge[p].cap-flow::edge[p].w));
}
//for(int i=flow::S;i<=flow::T;i++)
// for(auto p:G[i])cout<<i<<" "<<p.first<<" "<<p.second<<endl;
rep(i,f)dfs(flow::S);
for(int i=0;i<le.size();i++)nxt[le[i]]=ri[i]-cnt,du[ri[i]-cnt]++;
//cout<<le.size()<<endl;
//assert(le.size()==f);
int cur=0;
rep(i,cnt)
if (!du[i])
{
++cur;
int p=i;
while (p!=0)col[p]=cur,p=nxt[p];
}
rep(i,n)printf("%d ",col[belong[i]]);
puts("");
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4052kb
input:
5 5 1 4 2 3 1 3 2 5 5 1
output:
2 2 2 1 2
result:
ok AC
Test #2:
score: 0
Accepted
time: 1ms
memory: 4312kb
input:
5 7 1 2 2 1 4 3 5 1 5 4 4 1 4 5
output:
2 2 1 2 2
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 4140kb
input:
8 6 6 1 3 4 3 6 2 3 4 1 6 4
output:
1 1 1 1 2 1 3 4
result:
ok AC
Test #4:
score: 0
Accepted
time: 594ms
memory: 6464kb
input:
7000 6999 4365 4296 2980 3141 6820 4995 4781 24 2416 5844 2940 2675 3293 2163 3853 5356 262 6706 1985 1497 5241 3803 353 1624 5838 4708 5452 3019 2029 6161 3849 4219 1095 1453 4268 4567 1184 1857 2911 3977 1662 2751 6353 6496 2002 6628 1407 4623 425 1331 4445 4277 1259 3165 4994 1044 2756 5788 5496 ...
output:
1 1182 1589 729 368 2 3 679 144 1037 409 1378 4 1594 1021 5 212 6 47 25 61 1701 1616 524 567 7 8 755 251 9 292 1426 10 11 1494 510 1228 12 1640 13 324 1106 14 765 15 1162 16 691 17 18 532 19 733 1396 205 334 901 20 129 21 1679 1187 267 546 509 22 1694 1197 1016 23 24 1707 25 1364 26 207 1128 780 141...
result:
ok AC
Test #5:
score: 0
Accepted
time: 715ms
memory: 6412kb
input:
7000 6999 4832 1603 5984 6985 5355 3687 6007 2170 5984 3486 3267 2189 538 2123 4343 4553 5855 6168 5984 257 4239 2304 5984 2063 3298 1869 5984 6353 5984 2018 5984 5387 5984 3382 3164 3978 2690 2816 4810 2638 5984 3773 5984 1634 5984 2786 5984 3671 5984 5140 2943 5721 5984 414 1105 4060 3093 796 5984...
output:
246 236 1507 1790 1865 361 768 503 2172 98 82 1472 1988 389 1029 1 685 963 1217 1762 2 968 383 354 784 2092 1628 88 764 1172 1687 770 965 1597 3 4 447 1351 2002 1340 5 710 174 6 1065 7 1806 8 9 123 718 153 1408 471 1832 1741 10 11 12 13 2130 2221 14 132 1352 1240 775 2148 1650 20 15 2035 1797 1215 1...
result:
ok AC
Test #6:
score: 0
Accepted
time: 807ms
memory: 6320kb
input:
7000 6999 1649 5337 1701 3344 4394 2172 3330 39 5932 1141 5381 5340 5453 3300 125 2172 6810 5263 804 2172 6635 2172 676 4740 3015 1183 1710 5769 611 5915 3419 1581 2094 2172 4508 2172 6604 2433 6113 1466 1604 696 1518 1123 1287 2940 4825 2172 5130 4524 2693 2172 106 2172 5157 2172 3693 2172 5198 217...
output:
1 2 1021 1438 2076 3 1900 1285 449 4 1397 5 6 1321 545 844 7 1276 289 348 332 8 9 1224 796 1577 222 1184 10 11 651 12 225 157 918 13 1196 1154 2089 14 1682 1523 507 15 1278 1932 392 1478 16 2218 1306 17 297 2056 363 1430 1430 18 706 2320 19 2169 20 1855 747 960 1738 2235 21 22 23 24 25 1505 1025 148...
result:
ok AC
Test #7:
score: 0
Accepted
time: 322ms
memory: 6556kb
input:
7000 6999 2896 6321 881 2623 5058 2623 4833 2623 4669 2623 4781 5007 1447 2623 4781 4768 4781 3834 2758 4792 797 5055 3784 2623 4781 5510 6606 3040 597 3459 4136 2037 1291 3989 4781 837 4781 4379 5637 2053 1642 2665 4781 4664 4781 952 4924 2511 4781 4201 4781 2352 4781 5362 3901 197 137 2623 2706 19...
output:
1 345 87 1728 250 71 229 2 354 3 175 1596 1695 1039 404 1443 1548 1720 879 4 1345 531 795 607 1367 1504 1428 1007 5 6 727 7 866 1518 190 317 1536 226 1373 699 638 1469 879 826 8 298 9 476 10 397 1646 563 11 12 781 13 1495 1042 783 944 14 78 764 113 959 15 272 1499 1215 1743 325 1572 598 16 1734 1350...
result:
ok AC
Test #8:
score: 0
Accepted
time: 6ms
memory: 5972kb
input:
6999 6998 1269 3969 1269 2429 1269 2609 1269 2515 1269 6166 1269 6614 3108 1269 2105 1269 4670 1269 578 1269 4661 1269 1421 1269 2576 1269 6152 1269 1269 6636 3011 1269 305 1269 5189 1269 1683 1269 6861 1269 1269 5798 1499 1269 282 1269 914 1269 80 1269 677 1269 701 1269 1269 359 6521 1269 1269 1754...
output:
1 2 3 4 1072 5 6 2666 1044 3244 3303 2945 7 433 8 9 10 975 11 12 124 13 14 2691 15 16 17 18 19 1674 20 1066 21 22 3193 23 1613 458 24 514 970 25 26 1203 3087 27 28 29 30 31 2521 1551 3492 32 262 2394 33 34 35 36 37 576 19 38 3395 2832 3336 39 40 41 524 42 729 1744 2102 43 44 2791 45 46 2094 47 2379 ...
result:
ok AC
Test #9:
score: 0
Accepted
time: 2ms
memory: 4868kb
input:
7000 0
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok AC
Test #10:
score: 0
Accepted
time: 1ms
memory: 6508kb
input:
7000 6999 3138 1903 3285 5919 6182 1430 1164 961 1577 6445 1390 3384 935 5723 6614 6387 4799 2877 3915 5128 5366 5455 2287 3941 2053 2326 4022 6993 488 2922 4327 4701 4674 3221 1666 4773 4356 3232 3888 937 4318 6942 577 1299 4491 1938 5154 1254 790 5532 4286 5478 2918 6725 2853 304 2554 5207 5140 77...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok AC
Test #11:
score: 0
Accepted
time: 5ms
memory: 5632kb
input:
7000 6999 33 3147 5877 4807 3116 4168 1651 2456 624 1740 6440 3058 6414 489 1023 2523 706 93 5523 598 4211 6063 3570 6840 6566 2971 6614 1907 5893 4389 4022 2527 5096 2345 4682 2134 188 5597 695 4285 1344 3832 3534 879 6574 6252 3759 3444 2167 85 5630 6600 3158 4404 6389 689 4871 6719 4295 6008 3437...
output:
44 50 70 70 40 40 70 67 70 70 70 70 70 1 70 67 70 41 70 70 20 70 50 70 70 70 70 70 70 70 70 70 2 70 70 67 7 28 70 70 70 40 16 70 3 70 20 70 70 67 70 70 70 70 70 67 70 70 70 48 20 7 7 70 70 70 70 71 50 70 65 50 70 70 40 70 53 71 50 70 44 27 70 70 13 55 70 70 27 70 50 70 70 70 70 31 4 70 13 70 70 70 7...
result:
ok AC
Test #12:
score: 0
Accepted
time: 2ms
memory: 5304kb
input:
7000 6999 1247 5150 3318 2013 5686 1615 6145 6521 5717 94 2787 3443 2648 4875 5332 5934 1897 1651 4640 2183 1750 6964 148 5228 745 2814 474 1165 496 6735 180 3412 2723 3374 6200 4361 497 5328 1928 5998 5648 1261 5090 4723 1715 706 2499 897 6569 6204 6039 2787 2882 5044 5767 4256 975 1877 1857 4453 6...
output:
274 1 274 62 274 274 72 274 218 274 16 259 74 274 274 75 274 274 274 274 274 274 274 274 274 274 213 274 130 2 274 274 274 274 274 274 195 274 115 274 274 274 215 274 274 62 274 274 274 176 232 3 274 274 274 274 274 49 16 274 62 84 274 274 274 259 274 274 20 104 274 268 130 274 274 274 274 274 4 68 ...
result:
ok AC
Test #13:
score: 0
Accepted
time: 0ms
memory: 5856kb
input:
7000 6999 2349 199 5295 2831 6143 2006 3212 3198 6956 3807 732 4838 5069 1027 5744 3479 6 5301 5687 4452 4201 1151 1353 4884 548 3506 6094 4799 4950 6939 5234 817 652 1314 979 6984 5771 1851 398 1322 2294 4298 847 3929 6833 183 2904 6745 4797 3874 94 315 4282 582 6591 5037 962 147 799 908 2593 5547 ...
output:
1049 1 105 1049 1049 354 880 565 666 259 385 1049 1034 348 955 1049 668 676 2 410 998 1049 1049 3 846 1049 1049 4 451 1049 308 769 741 264 1049 445 1049 1011 622 236 934 1049 393 764 1049 5 992 1049 1049 6 845 466 7 8 961 9 259 414 10 759 1049 1049 277 1049 1049 889 105 374 92 376 1049 1049 1049 104...
result:
ok AC
Test #14:
score: 0
Accepted
time: 2ms
memory: 6008kb
input:
7000 6999 3409 1629 2076 6412 4997 1078 6320 626 4501 1104 4173 1774 5507 2375 2299 5115 4321 127 1192 6635 1909 3398 2972 499 862 5024 421 2931 861 1536 902 3813 659 4514 1843 3035 3669 1228 1724 1880 34 706 133 3468 6116 585 5073 1461 5667 3405 715 4834 6915 3007 1736 6108 3264 2870 2393 6474 2108...
output:
815 2604 1 1647 2604 2 1001 2604 1867 3 1554 4 2604 5 6 2421 136 2604 999 1808 2604 7 2604 1684 8 2604 9 10 11 12 2604 13 2604 14 97 933 1995 1471 15 1080 2217 1323 296 576 2604 90 292 509 16 2364 620 1356 2604 2104 2604 2453 885 2520 17 18 2251 2604 901 19 2382 20 125 21 2302 22 732 1149 23 1469 11...
result:
ok AC
Test #15:
score: 0
Accepted
time: 13ms
memory: 6096kb
input:
7000 7000 2048 5882 6801 2408 3225 2608 1441 5079 497 6253 557 5589 2535 6257 4800 2595 4713 1286 4759 6636 4303 4296 6195 2048 6994 2987 1249 3044 1036 10 6472 2076 1996 1086 1279 1486 6100 369 4797 3437 2493 4576 2944 5601 197 5582 5488 5035 4023 659 2651 5024 2257 5710 1001 3941 446 4815 687 702 ...
output:
1 2 3 4 5 6 1982 9 10 569 11 362 13 1875 1942 1864 22 23 838 2645 1036 24 775 463 25 173 489 30 29 1324 961 36 2039 1586 1594 38 39 40 1424 41 42 390 43 1142 1064 44 45 700 1397 268 47 1618 48 1842 1254 1476 50 175 656 1046 52 669 1412 54 873 55 2798 2886 56 1431 60 700 1773 203 61 1772 63 2567 66 6...
result:
ok AC
Test #16:
score: 0
Accepted
time: 16ms
memory: 6244kb
input:
6993 7000 6927 2941 6385 1428 6914 2553 2474 4268 2068 1640 2298 6960 6201 1806 4912 59 4407 5504 1595 6868 6378 2515 3713 3724 2995 2589 2314 2932 4042 431 6322 4178 5947 6850 6192 735 3802 1043 4982 1575 311 6496 5006 3191 6473 3084 2387 4706 6632 5901 5113 3066 5248 1274 5671 717 1311 4261 1960 3...
output:
1786 1206 10 2570 1863 11 2518 12 1835 13 14 640 2619 22 23 26 779 27 1623 1361 29 30 908 2499 488 1320 909 1340 2828 919 33 34 35 827 36 42 1731 2609 37 1340 47 48 1836 2848 57 2806 1276 49 50 1193 51 1657 55 387 56 57 58 2994 2923 304 2906 1857 318 2342 59 1167 1003 61 62 1428 63 833 64 2681 80 19...
result:
ok AC
Test #17:
score: 0
Accepted
time: 11ms
memory: 6036kb
input:
6930 7000 3746 2945 3523 6758 4109 1106 2732 5415 2423 844 3702 6309 6503 5362 5997 6294 5688 1396 4842 1764 4780 4521 1254 826 37 4653 2138 2358 6345 1223 1385 2341 5261 5867 4815 2918 4209 696 4235 2314 3680 2919 5605 5155 6643 3391 2691 1418 6289 2093 1970 1804 828 5237 4025 1111 1164 5519 5889 2...
output:
1 3 4 2626 1341 1329 7 8 2536 2879 692 502 2526 9 10 13 14 2178 2334 1837 1031 15 1926 1484 16 17 2821 18 1314 20 1841 22 23 1398 2152 1933 24 2668 55 25 26 27 1336 28 453 2450 29 2400 319 2033 2570 32 818 33 41 42 44 45 339 166 1813 46 726 2427 1303 47 1930 1353 2673 2469 49 1728 50 51 52 180 896 2...
result:
ok AC
Test #18:
score: 0
Accepted
time: 12ms
memory: 5920kb
input:
6300 7000 5921 5466 723 5843 1084 3134 3865 5742 5492 2885 328 4408 6055 4074 3702 2240 1342 2353 295 734 553 48 4454 2980 1248 4460 5023 19 2784 441 105 844 6048 1773 4840 5260 3910 1292 5578 2864 4978 3116 6182 4962 2575 1661 5030 435 5861 4709 5033 358 1746 5816 5877 3921 2678 5679 1784 33 207 59...
output:
302 1 2149 2 1429 3 205 2286 4 218 5 6 2319 7 8 9 10 13 151 320 14 15 1654 16 799 17 1746 820 294 2385 1161 1149 788 19 20 21 149 686 1362 311 1321 2101 1125 389 52 22 1694 1183 23 1069 1876 1880 28 21 1474 31 32 1504 1547 1418 2060 2384 36 37 38 39 40 2051 633 56 1058 41 42 1109 43 2157 2045 44 45 ...
result:
ok AC
Test #19:
score: 0
Accepted
time: 1ms
memory: 4744kb
input:
2800 7000 218 2670 1436 2268 38 2781 55 783 549 1627 660 1609 2268 2645 1376 1395 2747 71 785 1451 1096 2633 2655 2557 1569 307 16 56 1993 2751 1154 2760 478 2452 1841 2764 155 1781 215 1432 1788 2548 193 2665 167 1038 2425 2314 439 1615 269 1187 1222 245 1638 2016 2352 1511 2333 1564 1667 2576 1751...
output:
1 254 254 254 14 254 254 2 254 254 254 254 254 254 254 254 254 254 3 254 254 254 254 28 254 254 254 254 254 254 126 4 254 254 254 241 254 254 254 254 254 254 254 254 39 254 254 254 254 5 254 42 254 254 254 254 254 254 254 254 254 6 254 7 254 254 29 176 71 254 254 254 8 254 254 9 254 254 254 254 254 ...
result:
ok AC
Test #20:
score: 0
Accepted
time: 10ms
memory: 6040kb
input:
7000 7000 4828 3840 4148 2678 1645 2954 5516 1204 4664 285 904 1978 1434 1688 1902 5205 1324 4512 1722 1246 6724 5227 524 196 937 6286 6609 4724 5408 5610 4405 2463 5493 1567 2625 2894 2378 3685 5399 6872 6475 6546 5697 1265 1811 1314 2347 3005 6245 271 2414 434 3492 6948 4447 599 793 6107 464 5353 ...
output:
1 2569 2445 2 1700 2907 3 1720 4 5 312 123 1898 2716 7 3186 2896 3109 8 1383 1687 9 2872 10 1726 1726 1590 11 12 14 1368 1256 15 2244 3358 16 17 2377 18 411 19 2192 20 22 720 23 24 2821 25 1896 1359 26 27 634 28 29 3443 30 2785 31 32 33 407 2588 34 3308 35 2432 38 1272 39 40 41 42 304 43 832 491 226...
result:
ok AC
Test #21:
score: 0
Accepted
time: 10ms
memory: 6108kb
input:
6993 7000 1576 5558 2853 3183 212 2572 1001 75 3386 6483 401 22 489 6768 6520 1684 6439 6188 3810 6414 4088 1924 371 1666 2822 410 5664 1676 1043 1365 384 2688 4179 6357 6466 4630 2829 4371 116 6817 1535 6172 751 5740 499 2484 2013 4576 6556 670 6177 3847 5344 4280 6103 1055 496 4934 6639 217 6606 4...
output:
2755 2 4 1174 5 1066 672 1871 6 7 8 9 10 11 2234 2491 1628 12 3639 1952 13 1699 3220 3420 2506 2022 14 1352 509 15 16 2001 1430 17 18 19 703 20 952 21 1929 3158 22 23 1951 24 25 26 3102 2320 27 520 3573 28 29 30 3108 1626 1469 1038 31 35 36 3368 2025 180 264 37 2788 3215 38 39 40 42 2920 43 44 3316 ...
result:
ok AC
Test #22:
score: 0
Accepted
time: 9ms
memory: 6004kb
input:
6930 7000 2378 5636 2953 3870 897 2126 112 1756 3302 5114 4591 5593 5408 4899 1204 6313 6254 2214 5360 6680 2354 5865 5959 5969 1628 5317 6396 1006 2402 1767 1921 3373 3758 312 2167 5711 4119 6585 19 3951 1714 1206 3754 4376 4516 307 6312 165 5721 2470 4828 4842 4520 4310 1922 4946 2006 3856 1218 58...
output:
3603 1 2 3 4 326 5 3492 6 7 64 8 2852 1057 11 12 14 1871 15 16 2642 3301 17 487 19 736 2645 3081 1901 20 21 22 3099 1771 24 1824 25 3047 26 27 29 30 31 32 1807 33 34 38 39 40 3538 997 41 42 43 44 45 46 47 48 49 800 50 51 2938 2591 53 1586 54 56 101 57 2323 407 58 2506 59 60 61 1349 149 64 65 69 1253...
result:
ok AC
Test #23:
score: 0
Accepted
time: 9ms
memory: 5872kb
input:
6300 7000 1562 45 1716 2699 5291 4828 5063 4588 5888 4130 5901 6109 1476 921 3390 5892 5425 3782 824 5679 2278 6102 6146 5556 4874 2115 2842 2803 1963 5131 3736 2611 320 5272 758 5667 4087 228 5139 760 1812 2968 2897 6117 277 387 336 1322 4319 4597 608 4481 6182 3050 4333 3570 401 1662 3085 3197 537...
output:
1 2 1187 1709 3 2016 2833 4 72 5 1316 6 9 1766 1365 10 2832 2408 2491 11 2431 12 13 14 989 15 1931 16 2027 2059 2465 17 314 2435 2138 1357 20 21 1801 925 23 742 24 25 26 1366 27 483 28 3028 29 30 1561 31 50 761 32 33 1729 34 35 362 2498 1938 1771 2028 37 39 3108 42 44 45 1583 48 2175 49 50 52 2780 1...
result:
ok AC
Test #24:
score: 0
Accepted
time: 6ms
memory: 5540kb
input:
2800 7000 931 1154 1783 1159 2515 1596 1734 1277 825 430 938 208 288 684 970 2075 618 2411 2690 500 223 2162 2093 2765 172 1029 832 1571 89 2333 2301 981 1354 1094 1989 137 2340 1804 2600 1249 1714 2343 1043 2738 1375 1239 804 2578 424 1572 568 1945 2233 297 1890 519 1475 944 2732 1123 2012 927 2232...
output:
371 1 461 2 471 5 754 6 368 7 147 403 794 507 8 575 90 782 760 825 55 216 228 10 480 14 451 47 11 496 12 13 813 14 17 18 19 123 382 20 21 28 2 169 22 701 24 526 25 750 26 27 28 158 580 29 666 348 30 31 544 32 812 526 673 33 35 205 757 748 347 278 135 40 615 554 83 639 808 428 812 42 267 457 227 457 ...
result:
ok AC
Test #25:
score: 0
Accepted
time: 0ms
memory: 4148kb
input:
52 41 18 31 2 5 22 32 1 50 50 29 9 32 44 27 45 17 26 24 18 30 28 25 38 28 5 47 49 38 23 50 8 3 16 24 29 46 7 52 30 38 33 32 39 32 3 18 50 44 1 35 49 37 18 24 29 6 20 39 40 45 33 28 51 52 26 40 38 43 52 45 39 40 42 34 6 45 32 19 20 52 34 28
output:
3 4 8 6 4 2 7 8 9 10 11 12 13 14 15 16 21 8 22 17 18 19 20 16 25 21 20 25 2 8 5 22 22 25 3 23 27 8 17 21 24 25 8 20 21 1 4 26 27 20 28 28
result:
ok AC
Test #26:
score: 0
Accepted
time: 0ms
memory: 4132kb
input:
291 56 117 283 21 277 128 22 245 45 8 223 150 129 16 15 224 163 288 76 218 238 25 233 100 262 244 101 76 207 286 80 164 238 165 283 133 251 23 235 22 280 65 205 8 30 66 76 232 90 251 287 80 62 58 218 285 225 247 199 149 34 219 16 286 221 174 248 20 58 169 69 229 119 178 216 152 147 148 189 116 207 7...
output:
1 44 2 3 4 5 6 8 9 10 11 12 13 14 190 190 15 16 17 18 78 114 19 20 21 22 23 24 25 8 26 27 28 29 30 31 32 33 34 35 36 37 38 39 207 40 41 42 43 44 45 46 47 48 49 50 51 18 52 53 54 71 55 56 57 58 59 60 148 61 62 64 65 66 67 243 68 69 70 71 72 73 74 75 76 77 78 79 80 199 81 82 83 84 85 86 63 87 88 89 21...
result:
ok AC
Test #27:
score: 0
Accepted
time: 1ms
memory: 4028kb
input:
26 295 19 5 19 13 10 2 14 13 19 24 20 13 9 3 18 11 13 25 13 14 24 6 1 2 25 6 6 13 7 25 1 9 2 8 6 8 13 18 2 7 11 9 14 12 21 19 17 23 8 14 3 5 22 8 8 3 25 5 24 21 10 3 23 13 24 20 3 21 23 18 7 15 24 18 18 21 18 4 8 12 13 9 12 1 14 9 18 20 9 22 10 25 3 26 2 14 5 20 1 24 24 1 23 6 18 6 21 11 19 4 24 25 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok AC
Test #28:
score: 0
Accepted
time: 1ms
memory: 4104kb
input:
63 1000 22 9 25 11 52 54 34 30 18 8 24 3 42 30 61 51 34 17 36 52 58 9 41 53 19 12 40 3 54 47 23 51 44 59 10 21 35 52 34 56 43 15 39 41 12 37 13 21 55 48 16 57 39 25 26 25 22 57 54 34 63 55 11 27 60 40 41 1 24 59 20 53 14 6 51 35 44 9 47 35 32 39 40 28 9 49 29 27 16 25 56 53 28 56 5 39 35 57 61 37 22...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok AC
Test #29:
score: 0
Accepted
time: 0ms
memory: 4092kb
input:
42 113 29 15 21 15 28 13 30 42 7 33 4 31 16 18 11 36 38 13 33 6 28 27 17 19 21 25 42 4 19 16 8 37 38 4 4 19 20 22 33 27 26 42 31 39 14 29 6 32 20 12 40 6 32 28 23 18 41 22 10 4 7 28 31 13 14 24 37 40 9 20 26 32 13 18 35 29 9 29 34 26 19 32 20 25 34 39 33 23 28 35 35 22 7 16 40 13 39 24 24 20 18 24 4...
output:
2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
result:
ok AC
Test #30:
score: 0
Accepted
time: 1ms
memory: 4112kb
input:
6 8 5 1 1 5 6 5 4 1 4 3 2 4 5 3 3 4
output:
2 1 2 2 2 2
result:
ok AC
Test #31:
score: 0
Accepted
time: 4ms
memory: 6004kb
input:
7000 6999 6253 1991 6253 4600 1137 6253 1764 6253 6253 908 6253 2205 6253 213 6253 4399 6300 6253 4601 6253 6253 4884 6937 6253 6253 4070 2646 6253 1007 6253 6552 6253 6253 2115 6253 922 6223 6253 6253 2496 3522 6253 2050 6253 6253 763 6803 6253 6253 3847 2816 6253 6253 6297 6253 471 6253 3211 3203 ...
output:
1 2 2485 3292 3 1832 4 114 1796 5 6 2957 1354 3215 7 394 8 9 2895 10 11 176 3195 12 13 2265 14 1103 91 2612 1186 1064 15 16 17 2432 18 438 381 603 920 19 2173 20 903 21 754 22 23 24 721 2453 25 26 27 165 1378 2211 1183 2037 28 640 964 29 2302 30 31 3319 513 32 946 33 34 1029 2844 35 1702 36 37 38 39...
result:
ok AC