QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#704155 | #167. Modern Announce Network | TheZone | AC ✓ | 94ms | 9620kb | C++20 | 6.3kb | 2024-11-02 19:25:10 | 2024-11-02 19:25:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+1e3+7;
int n,a,b,c;
int bel[N];
int f[N][8];
vector<int> v[3];
vector<int> g[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<3;i++)
{
int w;
cin>>w;
v[i].resize(w);
}
fill(bel+1,bel+n+1,-1);
for(int i=0;i<3;i++)
{
for(auto &x:v[i])
{
cin>>x;
bel[x]=i;
}
}
int m;
cin>>m;
for(int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;
if(bel[u]!=-1)
u=bel[u]+n+1;
if(bel[v]!=-1)
v=bel[v]+n+1;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> vp;
for(int i=1;i<=n;i++)
if(bel[i]==-1)
vp.push_back(i);
vp.push_back(n+1);
vp.push_back(n+2);
vp.push_back(n+3);
for(auto i:vp)
{
fill(f[i],f[i]+8,1e9);
f[i][0]=0;
if(i>n)
f[i][1<<(i-n-1)]=0;
}
for(int S=0;S<8;S++)
{
for(int T=0;T<8;T++)
{
if(T!=(S&T))
continue;
for(auto i:vp)
for(auto v:g[i])
f[i][S]=min(f[i][S],f[i][T]+f[v][S^T]+1);
}
vector<vector<int> >q(n+1);
for(auto i:vp)
{
if(f[i][S]<=n)
q[f[i][S]].push_back(i);
}
for(int D=0;D<=n;D++)
{
for(auto x:q[D])
{
if(f[x][S]!=D)
continue;
for(auto v:g[x])
{
if(f[v][S]>f[x][S]+1)
{
f[v][S]=f[x][S]+1;
q[f[v][S]].push_back(v);
}
}
}
}
}
int p=-1,ans=-1;
for(auto i:vp)
{
if(p==-1)
{
ans=f[i][7];
p=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
}
else if(f[i][7]<ans)
{
ans=f[i][7];
p=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
}
else if(f[i][7]==ans)
{
int id=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
if(id<p)
p=id;
}
}
cout<<ans<<" "<<p<<"\n";
}
/*#include<bits/stdc++.h>
using namespace std;
const int N=1e4+1e3+7;
int n,a,b,c;
int bel[N];
int f[N][8];
vector<int> v[3];
vector<int> g[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<3;i++)
{
int w;
cin>>w;
v[i].resize(w);
}
fill(bel+1,bel+n+1,-1);
for(int i=0;i<3;i++)
{
for(auto &x:v[i])
{
cin>>x;
bel[x]=i;
}
}
int m;
cin>>m;
for(int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;
if(bel[u]!=-1)
u=bel[u]+n+1;
if(bel[v]!=-1)
v=bel[v]+n+1;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> vp;
for(int i=1;i<=n;i++)
if(bel[i]==-1)
vp.push_back(i);
vp.push_back(n+1);
vp.push_back(n+2);
vp.push_back(n+3);
for(auto i:vp)
{
fill(f[i],f[i]+8,1e9);
f[i][0]=0;
if(i>n)
f[i][1<<(i-n-1)]=0;
}
for(int S=0;S<8;S++)
{
for(int T=0;T<8;T++)
{
if(T!=(S&T))
continue;
for(auto i:vp)
for(auto v:g[i])
f[i][S]=min(f[i][S],f[i][T]+f[v][S^T]+1);
}
vector<vector<int> >q(n+1);
for(auto i:vp)
{
if(f[i][S]<=n)
q[f[i][S]].push_back(i);
}
for(int D=0;D<=n;D++)
{
for(auto x:q[D])
{
if(f[x][S]!=D)
continue;
for(auto v:g[x])
{
if(f[v][S]>f[x][S]+1)
{
f[v][S]=f[x][S]+1;
q[f[v][S]].push_back(v);
}
}
}
}
}
int p=-1,ans=-1;
for(auto i:vp)
{
if(p==-1)
{
ans=f[i][7];
p=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
}
else if(f[i][7]<ans)
{
ans=f[i][7];
p=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
}
else if(f[i][7]==ans)
{
int id=i<=n?i:*min_element(v[i-n-1].begin(),v[i-n-1].end());
if(id<p)
p=id;
}
}
cout<<ans<<" "<<p<<"\n";
}d
ddddd
d
d
d
d
d
d
dd
d
dd
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
d
xzzyyauuahuajygAUJAHSISAJAJSAKJSAKJSA
v发的机票loss
d
d*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
4 2 1 1 1 2 3 4 3 1 2 2 4 3 4
output:
2 1
result:
ok single line: '2 1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
4 1 1 1 2 3 4 4 1 2 1 3 1 4 2 4
output:
3 1
result:
ok single line: '3 1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
8 1 2 2 5 4 6 3 8 7 1 2 2 3 3 4 5 6 6 7 7 8 2 6
output:
2 3
result:
ok single line: '2 3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
6 1 1 1 4 5 6 8 1 2 1 3 2 4 2 5 2 6 3 4 3 5 3 6
output:
3 2
result:
ok single line: '3 2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
7 1 1 1 7 6 5 6 1 5 3 5 3 7 2 6 4 6 7 4
output:
4 3
result:
ok single line: '4 3'
Test #6:
score: 0
Accepted
time: 32ms
memory: 5856kb
input:
5972 1 1 1 858 519 2508 138909 427 592 393 5876 721 2128 3394 3627 5508 3953 5170 676 2670 3596 2368 1006 1297 4286 5088 1756 903 1909 5221 979 5349 5740 4785 2372 5336 2500 1746 4707 1527 5294 4816 1485 1473 5787 570 232 2465 1939 5945 877 2766 955 2223 3795 5323 5422 2171 3735 2845 3096 5086 1924 ...
output:
3 519
result:
ok single line: '3 519'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
197 1 1 1 73 54 118 14587 36 44 39 84 181 192 93 174 82 107 41 166 109 69 108 30 88 11 48 63 110 155 157 171 110 154 110 60 11 156 111 165 67 151 36 89 22 172 91 6 45 37 161 3 108 50 137 184 172 1 175 147 4 80 30 37 135 148 80 24 97 140 177 137 163 111 88 100 155 106 177 116 6 173 23 150 112 4 41 10...
output:
2 54
result:
ok single line: '2 54'
Test #8:
score: 0
Accepted
time: 63ms
memory: 6564kb
input:
6336 2112 2112 2112 4891 5334 3958 2407 2498 4326 1193 3650 2186 1927 4324 146 4511 227 312 1923 2472 6104 3973 1261 2750 337 4242 2890 1667 5922 3943 1611 5526 4069 5759 6153 2973 3000 766 3840 1128 6264 1577 2007 5016 548 2712 5941 4407 195 4195 2202 860 3720 4189 70 3827 779 2823 1312 2741 3376 5...
output:
2 1
result:
ok single line: '2 1'
Test #9:
score: 0
Accepted
time: 24ms
memory: 5092kb
input:
3016 1005 1005 1005 595 1916 435 2861 587 1108 2287 264 984 172 526 1660 1633 1675 1393 2168 1521 1540 2457 7 192 1142 922 561 542 2974 850 2831 2493 934 1371 2032 630 942 455 2039 2600 597 1787 1517 1080 1478 1183 110 1270 1362 562 1246 2456 2410 1804 409 1848 2572 1998 1884 2270 2325 762 2806 611 ...
output:
2 1
result:
ok single line: '2 1'
Test #10:
score: 0
Accepted
time: 74ms
memory: 8956kb
input:
5283 4004 743 425 1987 5092 4664 4951 1146 4182 3341 5277 4315 970 2473 4677 462 4614 3488 2087 500 824 4262 2037 4283 836 4149 130 2007 2747 4917 5281 1919 5048 2425 3395 677 4294 4228 3113 3509 5188 3418 2201 3441 5231 3889 4404 5109 3874 1177 3382 3430 1978 2711 1397 4783 2563 2534 3143 1737 3978...
output:
2 1
result:
ok single line: '2 1'
Test #11:
score: 0
Accepted
time: 60ms
memory: 8632kb
input:
7627 7446 123 48 7463 5452 869 4266 6050 6271 4793 5710 7539 6644 7326 6500 6846 4821 191 7007 5679 1575 4720 2729 5688 4246 1108 7530 1548 6889 3893 7390 4532 5700 3305 1668 7547 1770 4603 4265 548 1735 5987 55 6711 2071 3847 795 416 1670 5812 6626 3339 6418 6630 3013 1824 1431 354 7282 5247 810 58...
output:
2 1
result:
ok single line: '2 1'
Test #12:
score: 0
Accepted
time: 63ms
memory: 8356kb
input:
1393 270 260 96 927 1260 913 1270 617 1207 419 423 94 190 1019 851 258 889 532 635 743 1069 58 775 359 279 644 1082 880 87 124 961 754 1170 348 802 1337 722 950 584 121 729 396 1351 151 1340 239 982 575 429 1158 159 868 64 185 576 640 316 30 1059 457 981 719 777 163 328 727 947 890 1391 388 520 608 ...
output:
2 3
result:
ok single line: '2 3'
Test #13:
score: 0
Accepted
time: 70ms
memory: 7956kb
input:
9065 1304 1353 1671 9029 1771 6651 8244 4005 379 819 5198 8003 8259 8443 2739 863 1542 8119 2413 5794 701 6420 421 412 3271 4220 670 3134 3768 8740 5315 6325 8179 7873 4455 5218 8623 2761 1650 1903 78 1314 3098 8482 2997 5751 2069 6450 8242 8381 6350 5106 1581 3165 1727 5889 5590 359 7659 5791 3434 ...
output:
2 1
result:
ok single line: '2 1'
Test #14:
score: 0
Accepted
time: 61ms
memory: 7424kb
input:
10000 1 1 1 7732 4643 4037 252963 1513 6959 3133 4257 5340 4957 8654 3932 962 9073 3451 7171 6115 2151 1232 2483 348 6236 2024 6681 8177 6892 6424 2617 4395 9271 5072 6931 9143 5201 3225 3197 8703 6539 6939 2053 1373 4365 3694 2920 2539 897 4347 4712 6661 1575 938 9123 7637 9054 6975 1084 3678 2244 ...
output:
5 787
result:
ok single line: '5 787'
Test #15:
score: 0
Accepted
time: 68ms
memory: 8004kb
input:
10000 1 1 1 3917 6558 4715 287682 3947 5265 7710 6346 6386 7070 5505 5050 5978 8645 1331 3707 7880 3001 363 5110 3375 8630 3582 5666 4676 1648 9642 6250 6597 1844 9631 3322 6711 6240 6260 7365 3867 5101 5223 593 795 679 2828 3942 117 7459 9398 6050 1081 6374 2180 536 5844 8818 7795 504 7307 718 6509...
output:
5 934
result:
ok single line: '5 934'
Test #16:
score: 0
Accepted
time: 8ms
memory: 4012kb
input:
10000 3333 3333 3333 7276 6984 5852 527 5074 8462 328 148 3862 3577 6557 920 6108 5818 1274 6000 5224 2205 7565 2596 8562 3324 1837 6188 9970 1707 1667 1608 916 2514 5155 5572 74 1176 9429 2843 3605 2293 7424 9761 7376 8137 6693 2656 3066 6239 8956 1581 6190 5501 5819 8767 7707 7715 1500 5375 7583 2...
output:
2 1
result:
ok single line: '2 1'
Test #17:
score: 0
Accepted
time: 60ms
memory: 6328kb
input:
10000 3333 3333 3333 3018 9817 3090 5319 6539 7390 4923 5144 2939 6003 3150 5944 1742 6088 1119 9709 4554 4615 1301 877 4758 7425 9535 9383 2210 3790 1693 1632 4786 8905 4456 8612 1351 31 5906 4357 2406 7140 7773 6004 9557 5190 9088 1907 4951 5259 6891 2183 9644 8377 9495 1558 8045 4498 3452 6921 17...
output:
2 1
result:
ok single line: '2 1'
Test #18:
score: 0
Accepted
time: 78ms
memory: 9620kb
input:
10000 6940 2950 82 6736 4548 8713 8968 2844 9743 6893 3811 8617 9384 8461 2449 6934 360 6827 7693 4646 8132 6832 9776 218 3129 8108 9916 7540 8440 9720 8455 908 8924 4292 8649 9275 670 6306 2568 9531 1299 942 1931 5345 856 6944 6327 3583 9374 4355 3486 2827 7768 2690 2238 1134 2068 9986 7534 5767 22...
output:
2 1
result:
ok single line: '2 1'
Test #19:
score: 0
Accepted
time: 17ms
memory: 5092kb
input:
10000 6560 2083 1130 7730 3904 9794 8732 4216 2942 7254 4767 866 9555 1272 383 9470 5646 7786 8841 6950 3499 2423 3159 2065 4618 6483 8084 7216 1629 3495 6506 2409 1425 3817 146 7497 659 8529 911 1518 7251 9732 7671 8679 1125 8504 4416 3484 2358 9035 6328 69 4825 4860 1997 9875 2240 8093 9508 8939 7...
output:
2 1
result:
ok single line: '2 1'
Test #20:
score: 0
Accepted
time: 94ms
memory: 9012kb
input:
10000 1542 1660 1393 269 7230 654 8782 6949 165 9324 450 3513 6170 6522 5171 4834 164 8353 3145 9271 8696 9087 6741 8123 4899 2754 7512 9003 2286 2462 7761 9805 2440 5247 2934 7363 4612 1727 5140 6714 7509 997 32 4355 214 876 5925 2255 8178 4624 5863 8224 1014 9680 8582 4999 2235 6041 3047 3531 8605...
output:
2 4
result:
ok single line: '2 4'
Test #21:
score: 0
Accepted
time: 56ms
memory: 6812kb
input:
10000 642 524 527 5661 3423 8772 2081 4797 1249 5840 6122 1766 8085 2846 2011 5040 6920 9519 2152 175 5889 7796 3397 4844 6308 8843 3788 9919 7700 4064 7828 6805 5613 6699 4060 3430 6960 7003 3594 1157 5797 7064 4852 8855 348 3749 6030 8027 9347 3331 6233 5890 2241 9181 3814 6535 36 1417 550 7032 81...
output:
2 1
result:
ok single line: '2 1'
Test #22:
score: 0
Accepted
time: 3ms
memory: 5188kb
input:
10000 1 1 1 7974 7684 9257 9999 7974 7684 9257 7684 9257 4309 4309 2937 2937 3208 6612 3208 1888 6612 9613 1888 550 9613 8351 550 7646 8351 8264 7646 9413 8264 9413 2307 2307 390 8891 390 800 8891 800 6318 8675 6318 2771 8675 2771 6098 832 6098 832 9692 5459 9692 5459 1731 8125 1731 8125 1703 1703 3...
output:
2 7684
result:
ok single line: '2 7684'
Test #23:
score: 0
Accepted
time: 7ms
memory: 5084kb
input:
10000 1 1 1 6348 3744 8401 9999 6654 8927 3802 6654 61 3802 4361 61 4361 8265 6084 8265 1405 6084 2290 1405 2290 7544 7544 7168 3878 7168 3878 5896 2187 5896 2187 5126 6838 5126 6838 578 8749 578 7217 8749 7217 1186 1186 3160 3160 6678 6678 1054 4523 1054 4523 4568 4568 6461 8373 6461 6287 8373 6287...
output:
1701 5
result:
ok single line: '1701 5'
Test #24:
score: 0
Accepted
time: 3ms
memory: 3756kb
input:
10000 3333 3333 3333 5573 1189 1316 5860 7316 4494 2926 9344 866 8831 7145 1476 4054 6940 3462 4641 4545 8906 6302 5642 2816 4274 6315 7704 2555 7164 8755 8273 8182 2255 297 144 3859 7931 2072 7693 5576 4827 7160 4241 8667 3385 8003 8251 8675 5270 6794 8881 5821 6880 1097 7740 559 6016 4327 742 9460...
output:
2 1
result:
ok single line: '2 1'
Test #25:
score: 0
Accepted
time: 3ms
memory: 4148kb
input:
10000 3333 3333 3333 1099 3933 5557 3382 5028 5349 1568 343 2571 8936 7343 712 8874 7506 7311 4803 4023 454 7600 5009 2301 6619 3466 1552 3825 1032 9418 5847 4169 3713 4186 9839 8487 1377 4857 1280 1063 9952 6415 626 4225 5408 8445 387 3318 1188 7242 62 3154 2857 2279 598 1712 473 7256 4158 3982 501...
output:
2 1
result:
ok single line: '2 1'
Test #26:
score: 0
Accepted
time: 3ms
memory: 4596kb
input:
10000 7407 2076 341 3515 5360 270 4363 1322 4262 3710 8014 5002 4635 280 7341 1362 3889 1195 1881 9094 74 7346 535 8477 4153 7499 8511 9390 7319 3332 2245 1241 9365 8885 6677 3081 5780 8694 8413 5708 1401 225 2669 1498 3827 4509 3366 1391 46 3460 1574 2983 5799 5470 2965 5158 6844 6446 2318 9587 197...
output:
2 1
result:
ok single line: '2 1'
Test #27:
score: 0
Accepted
time: 3ms
memory: 4452kb
input:
10000 5360 4090 466 5482 6571 7522 5326 3769 4735 8704 205 738 3002 8050 9189 2713 9717 4444 1976 4823 7519 5149 1922 803 8922 6803 1076 8964 2783 1658 5744 8756 9889 8959 7503 1661 3634 8019 4529 6801 8041 3079 4954 5235 1052 3550 9020 8286 4923 2085 982 3739 1940 5017 516 8932 6319 1173 2980 7558 ...
output:
2 1
result:
ok single line: '2 1'
Test #28:
score: 0
Accepted
time: 0ms
memory: 5228kb
input:
10000 1685 726 1595 4210 5840 3622 3721 45 7022 3120 9774 522 2535 4044 3729 6034 7499 8488 78 9952 2204 6321 5300 390 3433 3356 5528 5699 5574 8322 7687 5281 7062 9892 5391 3640 2081 4237 3943 5240 9653 6020 7501 5406 9399 4541 7009 133 7266 1773 5824 5218 6003 1338 7169 257 9891 8103 5439 2869 771...
output:
2 1
result:
ok single line: '2 1'
Test #29:
score: 0
Accepted
time: 5ms
memory: 4832kb
input:
10000 501 572 1463 1856 3726 8782 1308 5356 2052 7318 8098 5749 3350 7035 4132 2706 7444 2754 5566 6946 7724 8724 5418 7060 202 2283 6976 5156 7801 4423 5612 9680 3658 4485 3481 7443 3192 7524 4420 4288 5007 3219 7319 2839 7251 6834 847 3044 3454 3982 2843 5147 8923 6371 4742 2284 6664 2466 9238 975...
output:
2 3
result:
ok single line: '2 3'
Test #30:
score: 0
Accepted
time: 2ms
memory: 4312kb
input:
5747 1 1 1 491 3467 4794 5746 491 3467 491 4794 4072 491 5224 491 491 318 2515 491 2828 491 491 2740 479 491 2110 491 4947 491 5246 491 491 5442 4155 491 491 2242 491 1379 975 491 491 860 3562 491 2166 491 1739 491 253 491 3030 491 3310 491 491 4888 725 491 491 4069 491 5276 491 5423 491 2423 491 45...
output:
2 491
result:
ok single line: '2 491'
Test #31:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
1110 1 1 1 824 277 421 1109 36 647 974 647 264 647 197 647 647 335 647 788 647 98 647 124 705 647 849 647 128 647 647 367 647 640 647 729 647 1054 599 647 647 698 647 741 647 294 768 647 647 418 450 647 3 647 686 647 153 647 647 766 647 1081 647 57 647 1073 647 410 74 647 647 28 343 647 720 647 452 ...
output:
3 277
result:
ok single line: '3 277'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
9774 3258 3258 3258 7798 4303 8403 7980 6143 4903 5091 3118 8985 2774 8127 2284 2323 9380 3060 6756 7709 3171 4229 6663 8856 8428 8603 3890 8748 4416 7447 7868 4045 3176 9259 8184 4529 8013 5257 9036 3137 2986 8968 3452 4171 262 2336 885 8130 1123 5929 6802 2193 8620 2162 5183 8086 2481 3063 1857 78...
output:
2 1
result:
ok single line: '2 1'
Test #33:
score: 0
Accepted
time: 3ms
memory: 3772kb
input:
8426 2808 2808 2808 7576 4888 7860 6075 8013 1436 6591 1327 4788 5198 6551 4941 6177 6086 4400 870 2113 6095 6297 7529 6849 7574 7515 2385 4083 1894 5814 6420 559 7150 3576 535 2172 1300 5654 6089 4165 6471 5721 7497 1134 2941 7813 7029 6237 8337 864 400 116 8199 3300 1628 3717 4777 712 7413 2207 91...
output:
2 1
result:
ok single line: '2 1'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
679 637 28 13 231 580 440 306 327 608 399 437 362 577 367 521 355 553 579 356 364 489 281 536 325 501 81 450 485 624 565 169 162 43 638 335 132 155 147 551 33 198 585 298 506 520 586 305 610 343 495 674 34 372 605 424 219 581 540 385 550 61 352 529 214 63 497 375 193 447 307 479 3 239 604 301 158 22...
output:
2 1
result:
ok single line: '2 1'
Test #35:
score: 0
Accepted
time: 1ms
memory: 4092kb
input:
1832 1519 167 120 402 586 1619 311 1319 1019 673 314 1742 1084 1411 1589 1332 1321 370 717 1049 1483 429 994 1471 1817 63 54 1655 447 296 1129 765 424 1485 413 1228 585 1738 1632 1633 259 1144 361 1380 359 945 122 83 1446 957 131 1172 1364 659 78 1762 728 160 1003 148 1469 1245 840 1566 1746 712 129...
output:
2 1
result:
ok single line: '2 1'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
2407 239 35 350 248 2047 877 175 2364 259 935 1060 36 1317 2044 257 343 103 88 1389 2264 1216 1003 1436 920 1306 921 2323 1785 1620 38 244 760 761 1911 1749 90 42 404 1081 1169 138 1021 993 1259 2147 1654 1647 1979 2260 55 1792 1752 2252 22 276 1778 1138 1862 1723 202 1175 1086 2372 757 1907 916 130...
output:
2 1
result:
ok single line: '2 1'
Test #37:
score: 0
Accepted
time: 2ms
memory: 4384kb
input:
4327 474 479 398 3526 1448 76 804 4274 3848 1609 33 773 3897 2982 3288 4172 2113 3869 508 198 2106 2828 2722 1288 1433 2284 3705 1604 2304 1372 398 3215 2965 2866 3652 2519 3975 2775 1665 399 2417 2770 2909 1795 1905 4114 4083 2544 4086 2247 353 2531 53 193 759 783 3320 1964 2752 3910 150 4081 3384 ...
output:
3 2
result:
ok single line: '3 2'
Test #38:
score: 0
Accepted
time: 3ms
memory: 3860kb
input:
166 1 1 1 75 24 144 13695 24 75 144 75 16 75 95 75 75 17 102 75 67 75 75 148 151 75 32 75 75 69 27 75 42 75 88 75 77 75 75 133 75 153 75 125 57 75 75 128 8 75 75 38 81 75 116 75 75 150 75 166 75 155 105 75 75 147 36 75 75 157 49 75 26 75 65 75 75 101 99 75 82 75 132 75 75 5 75 134 129 75 75 31 22 75...
output:
2 24
result:
ok single line: '2 24'
Test #39:
score: 0
Accepted
time: 42ms
memory: 6512kb
input:
753 1 1 1 96 748 509 283128 643 456 456 390 293 456 456 451 456 437 236 456 624 456 563 456 456 465 142 456 456 154 456 179 456 113 667 456 456 705 225 456 456 77 227 456 456 722 456 304 346 456 330 456 102 456 374 456 456 288 456 404 456 481 314 456 309 456 456 715 456 2 268 456 17 456 83 456 497 4...
output:
2 96
result:
ok single line: '2 96'
Test #40:
score: 0
Accepted
time: 3ms
memory: 3748kb
input:
166 55 55 55 20 92 54 31 153 90 164 46 108 161 72 15 155 110 3 36 87 4 77 156 125 57 159 14 105 32 52 29 59 121 102 68 55 93 115 137 42 70 23 34 116 145 75 129 12 130 5 112 94 39 48 141 18 157 19 135 50 132 138 123 16 146 139 67 99 118 6 13 63 143 136 51 10 76 27 26 28 88 95 162 109 114 81 41 71 154...
output:
2 1
result:
ok single line: '2 1'
Test #41:
score: 0
Accepted
time: 14ms
memory: 4608kb
input:
448 149 149 149 32 368 235 296 341 422 251 257 308 85 90 216 356 282 21 374 60 53 171 370 117 448 132 289 67 99 209 145 349 157 407 170 3 225 111 338 261 298 334 404 178 342 17 89 350 231 339 18 116 200 196 212 400 429 268 176 242 222 311 291 199 26 276 123 270 48 109 122 263 287 15 214 135 47 423 2...
output:
2 1
result:
ok single line: '2 1'
Test #42:
score: 0
Accepted
time: 30ms
memory: 5272kb
input:
571 531 31 5 466 128 87 30 565 277 267 462 564 358 5 197 258 40 186 137 345 86 199 467 149 244 172 59 344 147 482 412 511 72 285 158 519 459 233 442 486 369 268 353 464 326 372 218 80 552 217 69 503 433 120 546 352 420 230 478 236 336 472 198 389 499 187 101 401 1 343 71 90 52 316 430 53 537 332 216...
output:
2 1
result:
ok single line: '2 1'
Test #43:
score: 0
Accepted
time: 35ms
memory: 5556kb
input:
628 544 43 28 410 323 358 549 328 503 332 464 212 515 343 521 582 340 546 491 208 151 34 397 605 22 62 53 3 37 217 41 396 406 345 539 23 352 442 33 289 365 393 407 334 527 154 9 68 116 45 444 418 484 574 262 197 109 534 357 346 249 314 1 522 364 427 91 18 97 617 402 133 422 305 429 39 88 390 350 495...
output:
2 1
result:
ok single line: '2 1'
Test #44:
score: 0
Accepted
time: 69ms
memory: 6988kb
input:
929 182 141 127 448 702 735 312 8 298 677 650 71 433 30 191 42 232 333 464 85 260 340 278 497 504 860 725 654 845 875 536 727 530 396 510 274 559 773 285 129 252 495 246 353 57 87 371 146 154 615 119 750 283 793 644 235 79 684 3 213 669 836 754 527 362 32 31 914 589 304 847 166 682 58 584 855 382 92...
output:
2 1
result:
ok single line: '2 1'
Test #45:
score: 0
Accepted
time: 6ms
memory: 4040kb
input:
324 56 59 62 280 13 38 79 180 278 84 94 162 140 144 283 10 199 222 225 191 4 295 139 122 284 296 62 76 250 11 189 15 116 240 177 133 60 213 298 47 95 304 75 212 83 258 267 128 271 244 297 143 209 255 136 41 238 70 27 67 291 266 91 28 22 217 102 123 30 135 185 164 200 252 293 201 289 324 208 184 195 ...
output:
2 2
result:
ok single line: '2 2'
Test #46:
score: 0
Accepted
time: 70ms
memory: 7492kb
input:
1000 1 1 1 485 617 401 499500 485 617 401 485 485 138 628 485 271 485 793 485 435 485 485 94 485 186 485 539 976 485 594 485 485 252 424 485 485 595 210 485 724 485 485 618 328 485 485 634 802 485 485 758 485 394 485 838 485 626 485 787 886 485 157 485 485 745 485 222 800 485 84 485 813 485 514 485 ...
output:
2 401
result:
ok single line: '2 401'
Test #47:
score: 0
Accepted
time: 78ms
memory: 7568kb
input:
1000 1 1 1 3 160 95 499500 632 998 998 147 998 542 13 998 274 998 998 423 998 193 998 578 966 998 780 998 998 737 557 998 547 998 3 998 791 998 998 470 998 123 740 998 998 324 998 805 572 998 183 998 998 873 998 12 782 998 998 392 251 998 435 998 998 604 297 998 437 998 998 424 483 998 998 142 998 3...
output:
2 3
result:
ok single line: '2 3'
Test #48:
score: 0
Accepted
time: 83ms
memory: 9360kb
input:
1000 333 333 333 616 794 43 762 506 287 429 895 245 749 436 693 55 447 63 64 476 680 360 977 267 141 32 182 461 575 503 491 388 398 11 262 93 572 647 15 880 208 487 823 875 761 596 155 830 994 635 455 565 737 376 856 16 948 318 764 581 934 815 770 52 652 464 928 911 984 393 822 138 982 44 563 714 20...
output:
2 1
result:
ok single line: '2 1'
Test #49:
score: 0
Accepted
time: 83ms
memory: 7556kb
input:
1000 333 333 333 202 936 39 238 256 523 987 107 650 568 960 409 596 821 961 26 397 803 540 780 810 79 354 932 756 60 869 837 991 855 717 44 642 219 654 284 498 502 968 286 587 138 786 959 669 9 809 908 233 300 40 618 903 316 935 46 28 156 519 22 310 220 171 147 979 564 865 97 640 598 811 164 348 511...
output:
2 1
result:
ok single line: '2 1'
Test #50:
score: 0
Accepted
time: 88ms
memory: 8668kb
input:
1000 851 120 26 513 556 842 999 507 589 599 244 597 108 853 660 669 393 302 899 10 596 189 387 918 384 631 563 668 118 813 223 367 736 511 293 909 78 328 931 347 682 809 472 884 122 731 361 590 50 657 937 646 593 29 420 106 501 22 836 793 487 554 977 730 71 254 408 208 313 887 473 101 988 688 924 14...
output:
2 1
result:
ok single line: '2 1'
Test #51:
score: 0
Accepted
time: 81ms
memory: 9228kb
input:
1000 718 222 58 703 15 167 50 321 977 432 924 454 692 209 709 545 447 14 773 865 251 355 579 601 59 480 498 286 626 63 240 985 937 581 976 463 9 263 122 364 767 516 5 746 295 727 367 554 682 380 73 162 556 689 106 448 575 998 138 211 643 283 898 49 440 265 822 304 127 331 97 234 339 123 407 852 494 ...
output:
2 1
result:
ok single line: '2 1'
Test #52:
score: 0
Accepted
time: 79ms
memory: 7544kb
input:
1000 99 56 57 769 233 557 19 808 500 337 235 824 420 900 259 872 742 571 941 602 136 231 864 190 819 173 218 619 165 972 320 977 460 467 289 919 767 772 964 456 442 126 722 175 942 92 904 331 267 688 390 485 770 25 850 489 243 184 342 229 926 308 668 596 577 945 702 387 127 812 515 63 56 12 11 379 1...
output:
2 5
result:
ok single line: '2 5'
Test #53:
score: 0
Accepted
time: 79ms
memory: 7592kb
input:
1000 143 181 6 906 730 555 125 208 313 291 218 383 6 142 360 675 35 308 258 132 958 939 391 58 630 951 394 754 819 339 183 10 697 343 273 761 460 262 757 583 841 321 221 746 237 430 634 235 67 113 261 842 117 312 989 78 612 400 499 22 840 536 328 421 478 537 969 729 445 252 165 661 564 319 114 710 3...
output:
2 5
result:
ok single line: '2 5'
Test #54:
score: 0
Accepted
time: 6ms
memory: 4684kb
input:
10000 1 1 1 1949 7252 8002 9999 1949 7252 1949 8002 7067 8002 3300 1949 1949 3512 8002 8663 8519 7067 7067 805 3300 7646 7067 7019 3512 4063 4671 1949 7252 3702 8663 7722 5490 3702 6679 4063 7091 7722 6679 3052 4544 7252 8663 2563 7252 8877 4063 2792 7091 9583 7252 6011 2837 7646 457 7722 4491 6679 ...
output:
2 1949
result:
ok single line: '2 1949'
Test #55:
score: 0
Accepted
time: 6ms
memory: 4952kb
input:
10000 1 1 1 2424 4495 3829 9999 7187 3516 6260 3516 7187 4768 1648 7187 6260 3082 7187 4838 3082 8601 6260 7616 7616 3361 9649 3361 4541 4768 4780 3361 3361 6178 9554 3516 6603 7616 6603 7753 6178 5071 7753 4631 5334 9554 3082 3995 4 7187 4854 8601 8487 5071 8601 1615 238 6178 7803 7187 7753 9226 91...
output:
30 282
result:
ok single line: '30 282'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
10000 3333 3333 3333 6484 6947 8813 7759 9377 6208 7951 7298 1232 3760 4128 308 6257 699 8773 3136 1322 7074 8360 7077 6188 602 7779 4750 6239 9768 516 560 5891 4649 9474 4380 2838 8519 1327 7190 9509 9001 4953 5968 1833 2106 7089 8966 1739 1574 643 9918 9456 5868 67 2147 1872 8658 5417 2954 7985 97...
output:
2 1
result:
ok single line: '2 1'
Test #57:
score: 0
Accepted
time: 3ms
memory: 4060kb
input:
10000 3333 3333 3333 2346 9019 3808 3265 7223 7435 7666 3911 1738 5366 270 6840 7877 4099 2802 2156 4439 6000 5393 3572 1312 5371 5668 8535 7040 1755 8854 1145 8097 6875 2042 4642 2492 1061 6588 5344 7703 6615 1871 5789 6674 721 7142 7940 2875 397 9696 2525 413 455 6209 2120 5202 8499 5990 8026 5385...
output:
2 1
result:
ok single line: '2 1'
Test #58:
score: 0
Accepted
time: 3ms
memory: 4036kb
input:
10000 9783 168 34 6695 5151 2638 6078 9838 9669 9992 8451 7968 2984 7210 3612 4042 6722 1161 6477 4140 4900 8815 6929 789 2006 2831 9167 5370 2811 8 5754 8782 8982 4491 3661 2468 4981 7837 8937 6456 5039 4806 7967 3476 3599 7270 683 5013 2619 1151 3051 3518 3769 703 8878 8279 7956 7675 1803 6733 737...
output:
2 1
result:
ok single line: '2 1'
Test #59:
score: 0
Accepted
time: 3ms
memory: 4136kb
input:
10000 5965 2681 1297 1508 7419 9263 6884 9471 500 6322 608 6047 4949 8034 1785 3956 5398 7430 1217 6261 5848 1381 1122 1711 6658 229 7619 185 1257 6253 4800 400 132 5229 9453 9195 8748 6862 8986 3733 8189 3275 8036 9906 7724 6420 9705 4371 3758 1242 9362 2579 2336 1236 240 1779 1896 3116 6664 4142 7...
output:
2 1
result:
ok single line: '2 1'
Test #60:
score: 0
Accepted
time: 5ms
memory: 4828kb
input:
10000 1529 292 1181 488 6569 8157 649 8099 359 8077 4989 6298 4518 8058 4516 9493 5953 699 4521 4297 9008 5298 1430 6074 3691 7483 2676 6059 4241 1618 8567 4015 9242 7068 364 3568 4951 4791 1756 6177 4817 3715 5767 6485 1923 6741 6345 2569 7602 1910 786 5522 3238 1720 9666 1906 9406 3423 8910 8379 8...
output:
2 5
result:
ok single line: '2 5'
Test #61:
score: 0
Accepted
time: 6ms
memory: 4812kb
input:
10000 1255 1025 32 5990 1252 2581 712 482 220 2962 4361 3476 9966 1090 8328 6740 7220 5080 1273 6890 2531 7592 5893 1203 844 9477 9409 7768 9240 119 244 2296 5579 6024 6917 3561 1290 3386 7527 3027 9416 9064 5462 1601 4609 5303 8685 4030 4605 1484 9340 2333 2270 6798 4615 7663 4470 2971 1709 5126 66...
output:
2 1
result:
ok single line: '2 1'
Test #62:
score: 0
Accepted
time: 0ms
memory: 4656kb
input:
8191 1 1 1 4096 6143 8191 8190 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 24 49 25 50 2...
output:
35 1
result:
ok single line: '35 1'
Test #63:
score: 0
Accepted
time: 3ms
memory: 4368kb
input:
8191 1346 1346 1404 4096 4097 4099 4100 4103 4105 4107 4110 4111 4116 4119 4121 4129 4130 4131 4137 4138 4142 4143 4147 4157 4158 4159 4163 4164 4166 4167 4172 4176 4178 4179 4182 4188 4190 4193 4195 4196 4201 4202 4203 4204 4205 4207 4208 4210 4212 4213 4214 4220 4221 4223 4224 4225 4229 4235 4238 ...
output:
4 2049
result:
ok single line: '4 2049'
Test #64:
score: 0
Accepted
time: 5ms
memory: 5140kb
input:
10000 1 1 1 1 5000 10000 9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49...
output:
9999 1
result:
ok single line: '9999 1'
Test #65:
score: 0
Accepted
time: 0ms
memory: 5092kb
input:
10000 1 1 1 9998 9999 10000 9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48...
output:
2 9998
result:
ok single line: '2 9998'