QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#432612 | #8686. Zoo Management | Lynkcat | AC ✓ | 638ms | 184972kb | C++20 | 5.8kb | 2024-06-07 13:55:03 | 2024-06-07 13:55:04 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N
using namespace std;
const int N=400005;
int n,m,a[N],b[N];
int dfn[N],low[N],fa[N],DFN;
poly G[N],g[N];
unordered_map<int,int>Mp[N];
int kmp[N<<1];
int siz[N];
inline int gf(int x)
{
while (x!=fa[x]) x=fa[x]=fa[fa[x]];
return x;
}
void tarjan(int k,int fa)
{
dfn[k]=++DFN;
low[k]=DFN;
for (auto u:G[k])
{
if (u==fa) continue;
if (!dfn[u])
{
tarjan(u,k);
low[k]=min(low[k],low[u]);
if (low[u]>dfn[k])
{
Mp[max(u,k)][min(u,k)]=1;
}
} else low[k]=min(low[k],dfn[u]);
}
}
int exist_even;
int sta[N],tp;
int id[N];
void tarjan1(int k,int fa)
{
dfn[k]=++DFN;
low[k]=DFN;
sta[++tp]=k;
for (auto u:G[k])
{
if (u==fa) continue;
if (gf(u)!=gf(k)) continue;
if (!dfn[u])
{
tarjan1(u,k);
low[k]=min(low[k],low[u]);
if (low[u]>=dfn[k])
{
poly g;
int nn=0,mm=0;
g.push_back(k);
while (1)
{
int v=sta[tp];
tp--;
g.push_back(v);
if (v==u) break;
}
nn=sz(g);
for (int j=0;j<sz(g);j++) id[g[j]]=j+1;
for (int j=1;j<sz(g);j++)
for (auto v:G[g[j]])
{
if (id[v]&&id[v]<j+1) mm++;
}
for (int j=0;j<sz(g);j++) id[g[j]]=0;
if (nn%2==0&&nn>2) exist_even=1;
if (nn%2==1&&mm>nn) exist_even=1;
}
} else low[k]=min(low[k],dfn[u]);
}
}
inline int work(poly y,poly x)
{
int n=sz(x),m=sz(y);
for (int i=2,j=0;i<=n;i++)
{
while (j&&x[j]!=x[i-1]) j=kmp[j];
if (x[j]==x[i-1]) j++;
kmp[i]=j;
}
for (int i=1,j=0;i<=m;i++)
{
while (j&&x[j]!=y[i-1]) j=kmp[j];
if (x[j]==y[i-1]) j++;
if (j==n) return 1;
}
return 0;
}
inline int calc(poly g)
{
poly gg=g;
sort(gg.begin(),gg.end());
for (int i=0;i<sz(g);i++) g[i]=lower_bound(gg.begin(),gg.end(),g[i])-gg.begin();
poly vis(sz(g),0);
int res=0;
for (int i=0;i<sz(g);i++)
if (!vis[i])
{
int now=i;
while (!vis[now])
{
vis[now]=1;
now=g[now];
}
res^=1;
}
return res;
}
void BellaKira()
{
cin>>n>>m;
for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
for (int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
G[x].push_back(y);
G[y].push_back(x);
}
for (int i=1;i<=n;i++)
if (!dfn[i]) tarjan(i,0);
for (int i=1;i<=n;i++)
fa[i]=i,siz[i]=0;
for (int k=1;k<=n;k++)
for (auto u:G[k])
if (k<u)
{
if (Mp[u].count(k)) continue;
if (gf(u)==gf(k)) siz[gf(k)]++;
else siz[gf(k)]+=siz[gf(u)]+1,fa[gf(u)]=fa[gf(k)];
}
for (int i=1;i<=n;i++)
g[gf(i)].push_back(i);
for (int i=1;i<=n;i++) dfn[i]=low[i]=0;
for (int i=1;i<=n;i++)
if (gf(i)==i)
{
if (siz[i]>sz(g[i]))
{
exist_even=0;
for (auto u:g[i])
if (!dfn[u])
{
tarjan1(u,0);
tp=0;
}
poly x,y;
for (auto u:g[i]) x.push_back(a[u]);
for (auto u:g[i]) y.push_back(b[u]);
sort(x.begin(),x.end());
sort(y.begin(),y.end());
if (x!=y)
{
cout<<"impossible\n";
return;
}
for (int j=1;j<sz(x);j++)
if (x[j-1]==x[j]) exist_even=1;
if (!exist_even)
{
poly x,y;
for (auto u:g[i]) x.push_back(a[u]);
for (auto u:g[i]) y.push_back(b[u]);
if (calc(x)!=calc(y))
{
cout<<"impossible\n";
return;
}
}
}
else
{
int now=i;
poly nw;nw.push_back(i);
while (sz(nw)<sz(g[i]))
{
for (auto u:G[now])
if (gf(u)==i&&(nw.size()==1||nw[sz(nw)-2]!=u))
{
now=u;
nw.push_back(now);
break;
}
}
poly x,y;
for (auto u:nw) x.push_back(a[u]);
for (auto u:nw) x.push_back(a[u]);
for (auto u:nw) y.push_back(b[u]);
if (!work(x,y))
{
cout<<"impossible\n";
return;
}
}
}
cout<<"possible\n";
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 38460kb
input:
6 7 1 1 2 2 3 3 1 2 2 3 3 1 1 2 2 3 1 3 3 4 4 5 5 6 4 6
output:
possible
result:
ok single line: 'possible'
Test #2:
score: 0
Accepted
time: 11ms
memory: 34360kb
input:
5 6 10 10 20 20 30 30 40 50 50 40 1 2 2 3 1 3 3 4 3 5 4 5
output:
impossible
result:
ok single line: 'impossible'
Test #3:
score: 0
Accepted
time: 7ms
memory: 36560kb
input:
25 32 10 10 20 30 30 20 40 40 50 60 60 70 70 50 80 90 90 130 100 100 110 120 120 110 130 80 140 160 150 170 160 140 170 150 180 190 190 180 200 200 200 200 220 220 230 230 240 240 250 250 1 25 1 3 2 25 2 3 3 25 3 4 4 5 5 6 5 7 6 7 6 10 8 9 8 10 9 10 10 11 11 13 10 12 12 13 10 14 14 15 15 16 16 17 14...
output:
possible
result:
ok single line: 'possible'
Test #4:
score: 0
Accepted
time: 3ms
memory: 36640kb
input:
4 5 1 2 2 3 3 4 4 1 1 2 2 3 1 3 2 4 1 4
output:
possible
result:
ok single line: 'possible'
Test #5:
score: 0
Accepted
time: 7ms
memory: 36568kb
input:
26 31 70 170 210 230 160 130 180 110 40 200 140 120 90 30 220 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 220 20 160 60 190 120 40 130 100 1234 1234 666 666 88888 88888 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 14 15 10 15 3 16 16 17 3...
output:
possible
result:
ok single line: 'possible'
Test #6:
score: 0
Accepted
time: 7ms
memory: 36612kb
input:
23 29 70 170 210 230 160 130 180 110 40 200 140 120 90 30 220 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 160 20 220 60 190 120 40 130 100 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 14 15 10 15 3 16 16 17 3 17 3 18 18 19 19 20 20 21 3 2...
output:
impossible
result:
ok single line: 'impossible'
Test #7:
score: 0
Accepted
time: 7ms
memory: 36384kb
input:
23 29 70 170 210 230 160 130 180 110 40 200 140 120 90 30 30 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 160 20 30 60 190 120 40 130 100 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 14 15 10 15 3 16 16 17 3 17 3 18 18 19 19 20 20 21 3 21 ...
output:
possible
result:
ok single line: 'possible'
Test #8:
score: 0
Accepted
time: 7ms
memory: 34284kb
input:
27 31 70 170 210 230 160 130 180 110 40 200 140 120 90 30 220 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 220 20 160 60 190 120 40 130 100 1234 1234 666 666 88888 88887 88887 88888 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 14 15 10 15 ...
output:
impossible
result:
ok single line: 'impossible'
Test #9:
score: 0
Accepted
time: 6ms
memory: 34588kb
input:
23 30 70 170 210 230 160 130 180 110 40 200 140 120 90 30 220 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 160 20 220 60 190 120 40 130 100 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 12 15 14 15 10 15 3 16 16 17 3 17 3 18 18 19 19 20 20 ...
output:
possible
result:
ok single line: 'possible'
Test #10:
score: 0
Accepted
time: 3ms
memory: 34360kb
input:
26 31 70 170 210 230 160 130 180 110 40 200 140 120 90 30 220 70 230 140 190 80 30 180 80 60 170 50 50 90 200 20 10 10 100 210 150 150 110 220 20 160 60 190 120 40 130 100 1234 1234 666 666 88888 88888 1 2 2 3 3 4 4 5 5 6 6 7 1 7 2 8 8 9 2 9 3 10 10 11 3 11 10 12 12 13 13 14 14 15 12 15 3 16 16 17 3...
output:
impossible
result:
ok single line: 'impossible'
Test #11:
score: 0
Accepted
time: 7ms
memory: 36324kb
input:
1 0 1000000 1000000
output:
possible
result:
ok single line: 'possible'
Test #12:
score: 0
Accepted
time: 3ms
memory: 36404kb
input:
2 0 1000000 987654 987654 1000000
output:
impossible
result:
ok single line: 'impossible'
Test #13:
score: 0
Accepted
time: 7ms
memory: 36612kb
input:
9 11 10 20 20 10 30 30 40 40 50 50 60 60 70 70 80 80 90 90 1 2 2 9 1 9 3 9 3 4 4 5 3 5 6 9 6 7 7 8 6 8
output:
impossible
result:
ok single line: 'impossible'
Test #14:
score: 0
Accepted
time: 0ms
memory: 36436kb
input:
200 169 944791 944791 58451 32198 671963 109634 641261 285994 640166 853224 809541 583936 700164 58451 829480 459815 1420 466043 126697 501713 739296 553689 737840 218781 847811 567055 139002 700164 498982 886128 937395 640166 707472 476360 583936 171997 886128 687601 580209 934986 624698 1197 50726...
output:
possible
result:
ok single line: 'possible'
Test #15:
score: 0
Accepted
time: 29ms
memory: 42548kb
input:
40000 48064 56746 477507 323790 828246 933555 292103 628765 865820 784150 776858 638118 799763 581618 683470 909436 425844 566115 297050 91874 677598 558851 818673 714212 874998 705114 278040 372713 107972 909868 929093 435194 474652 262024 803647 411876 43755 533688 649231 398503 286311 640015 5198...
output:
possible
result:
ok single line: 'possible'
Test #16:
score: 0
Accepted
time: 34ms
memory: 43276kb
input:
47000 48453 699900 699900 153084 153084 220564 220564 767903 767903 153084 153084 575097 91966 964960 862329 896595 968430 401874 404284 631816 631816 495840 696972 783797 39984 220564 220564 889567 369680 220564 438542 641443 519982 72254 882923 641443 834248 255863 42829 145963 619019 635440 63544...
output:
impossible
result:
ok single line: 'impossible'
Test #17:
score: 0
Accepted
time: 398ms
memory: 153364kb
input:
400000 399999 394119 120409 178573 259415 181075 92933 284026 44168 259357 198668 40191 8170 171154 215034 209747 281418 281396 155212 347904 177189 234201 324114 361988 385873 61649 56835 368023 303190 208539 314797 117760 276567 79942 297639 308384 42338 288440 19590 20214 89516 60632 239902 15392...
output:
impossible
result:
ok single line: 'impossible'
Test #18:
score: 0
Accepted
time: 380ms
memory: 137692kb
input:
399999 399999 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950 223950...
output:
impossible
result:
ok single line: 'impossible'
Test #19:
score: 0
Accepted
time: 376ms
memory: 137472kb
input:
399999 399999 61060 336802 336802 336802 336802 61060 336802 336802 336802 336802 336802 336802 61060 336802 61060 336802 61060 336802 61060 61060 61060 61060 336802 61060 61060 336802 336802 336802 336802 336802 336802 336802 336802 61060 61060 336802 61060 336802 336802 61060 61060 336802 61060 33...
output:
possible
result:
ok single line: 'possible'
Test #20:
score: 0
Accepted
time: 428ms
memory: 147220kb
input:
399999 400000 91093 11762 229009 343073 200886 38890 202184 336313 396030 341621 392236 165572 8242 199211 397268 92626 32033 254405 70666 13605 314699 259611 95495 250811 272397 142324 334235 122771 163837 168331 234836 317142 158085 236293 277272 99039 292228 391222 248667 267070 333134 296135 138...
output:
possible
result:
ok single line: 'possible'
Test #21:
score: 0
Accepted
time: 473ms
memory: 95652kb
input:
320000 383827 77869 147738 149220 293646 2124 191736 70839 137483 333754 9503 11316 149832 107605 243260 378110 323631 25708 239224 156201 237901 267378 59569 910 141250 175083 115269 374078 144834 199819 178206 101547 295436 373780 168869 77899 70118 91564 193413 302943 308707 229047 295213 301358 ...
output:
impossible
result:
ok single line: 'impossible'
Test #22:
score: 0
Accepted
time: 470ms
memory: 95996kb
input:
320000 383936 224604 218583 388904 181855 38617 104717 189524 148499 280032 393414 34077 199332 252792 63295 237753 13680 356104 80895 134946 119216 335852 88006 116483 124457 239091 15341 141514 360349 233514 209399 120724 340697 302660 243750 23964 256248 343672 84325 270927 356559 367606 53205 14...
output:
possible
result:
ok single line: 'possible'
Test #23:
score: 0
Accepted
time: 328ms
memory: 80800kb
input:
320000 383958 276713 179108 66964 250837 1865 103789 101850 399018 14928 182865 365814 153849 115525 184123 174463 388323 319624 183760 289411 323689 344050 178663 360043 103388 22090 289334 30446 387708 330313 347125 165449 152722 385615 297549 280171 189611 180492 94886 124497 252570 51297 73411 2...
output:
possible
result:
ok single line: 'possible'
Test #24:
score: 0
Accepted
time: 385ms
memory: 105312kb
input:
392000 398148 227941 48465 61221 285008 229719 109858 282335 399323 259595 355059 157708 73827 130990 142505 324503 134516 220382 127208 242103 203 67380 192578 66735 72554 83871 148687 7952 305301 8237 254286 259995 193993 25356 221596 9781 96497 317972 65873 309482 296210 97474 389769 66636 359608...
output:
impossible
result:
ok single line: 'impossible'
Test #25:
score: 0
Accepted
time: 399ms
memory: 84100kb
input:
376000 397551 337687 310995 254043 295389 63445 381162 133370 281929 353026 361774 159817 290237 81998 225065 309142 253903 369717 123205 90171 296527 64590 233315 119949 116264 354359 76159 239175 393938 260785 225293 398090 308065 228206 107532 50193 206802 338396 38060 275814 275814 276123 224998...
output:
possible
result:
ok single line: 'possible'
Test #26:
score: 0
Accepted
time: 332ms
memory: 83172kb
input:
376000 397253 382847 382847 188304 287597 306052 386223 8130 180127 285490 394363 397539 219582 78981 78981 44528 386313 394599 208718 314472 182891 62275 352786 243382 383088 102824 384030 345154 157647 202228 200221 173833 130033 236152 339390 396105 233443 359889 359889 345708 325025 355265 11641...
output:
impossible
result:
ok single line: 'impossible'
Test #27:
score: 0
Accepted
time: 638ms
memory: 138000kb
input:
400000 400000 358494 24893 64288 384374 108965 37976 228752 208761 284570 333471 251569 13921 98286 278138 100264 371784 356252 159270 165528 375301 377202 147838 375768 26342 365441 33486 58168 362626 226018 115159 395963 100218 335238 342488 35558 247218 29291 259636 25973 250369 117919 387696 880...
output:
impossible
result:
ok single line: 'impossible'
Test #28:
score: 0
Accepted
time: 3ms
memory: 34260kb
input:
4 0 1 1 2 2 3 3 4 4
output:
possible
result:
ok single line: 'possible'
Test #29:
score: 0
Accepted
time: 5ms
memory: 36408kb
input:
5 0 1 2 2 1 3 3 4 4 5 5
output:
impossible
result:
ok single line: 'impossible'
Test #30:
score: 0
Accepted
time: 3ms
memory: 36396kb
input:
6 6 1 2 2 3 3 1 2 3 3 4 4 2 1 2 2 3 1 3 4 5 5 6 4 6
output:
possible
result:
ok single line: 'possible'
Test #31:
score: 0
Accepted
time: 4ms
memory: 34356kb
input:
4 3 1 2 2 1 3 3 4 4 1 4 2 4 3 4
output:
impossible
result:
ok single line: 'impossible'
Test #32:
score: 0
Accepted
time: 0ms
memory: 36324kb
input:
5 4 1 2 2 1 3 3 4 4 5 5 1 2 2 3 3 4 4 5
output:
impossible
result:
ok single line: 'impossible'
Test #33:
score: 0
Accepted
time: 9ms
memory: 36380kb
input:
7 6 1 2 2 1 3 3 4 4 5 5 6 6 7 7 1 2 1 3 2 4 2 5 3 6 3 7
output:
impossible
result:
ok single line: 'impossible'
Test #34:
score: 0
Accepted
time: 4ms
memory: 36320kb
input:
8 12 1 1 1 2 2 2 2 2 1 1 1 1 2 1 2 2 1 2 1 3 2 3 1 4 2 4 3 4 5 6 5 7 6 7 5 8 6 8 7 8
output:
impossible
result:
ok single line: 'impossible'
Test #35:
score: 0
Accepted
time: 10ms
memory: 38368kb
input:
5 5 1 1 1 1 1 2 2 1 2 2 1 2 2 3 3 4 4 5 1 5
output:
impossible
result:
ok single line: 'impossible'
Test #36:
score: 0
Accepted
time: 6ms
memory: 38604kb
input:
6 6 17 17 17 17 17 17 17 17 17 17 17 17 1 2 2 3 3 4 4 5 5 6 1 6
output:
possible
result:
ok single line: 'possible'
Test #37:
score: 0
Accepted
time: 3ms
memory: 36340kb
input:
3 3 1 2 2 3 3 1 1 2 2 3 1 3
output:
possible
result:
ok single line: 'possible'
Test #38:
score: 0
Accepted
time: 0ms
memory: 36396kb
input:
3 3 1 1 2 3 3 2 1 2 2 3 1 3
output:
impossible
result:
ok single line: 'impossible'
Test #39:
score: 0
Accepted
time: 3ms
memory: 38448kb
input:
4 4 1 2 2 3 3 4 4 1 1 2 2 3 3 4 1 4
output:
possible
result:
ok single line: 'possible'
Test #40:
score: 0
Accepted
time: 0ms
memory: 38604kb
input:
4 4 1 1 2 4 3 3 4 2 1 2 2 3 3 4 1 4
output:
impossible
result:
ok single line: 'impossible'
Test #41:
score: 0
Accepted
time: 0ms
memory: 34280kb
input:
7 9 2 1 1 2 3 3 4 4 5 5 6 6 7 7 1 2 2 3 1 3 3 4 4 5 3 5 5 6 6 7 5 7
output:
impossible
result:
ok single line: 'impossible'
Test #42:
score: 0
Accepted
time: 5ms
memory: 34568kb
input:
6 9 2 1 1 2 3 3 4 4 5 5 6 6 1 2 1 3 2 3 3 4 3 5 4 5 5 6 1 5 1 6
output:
possible
result:
ok single line: 'possible'
Test #43:
score: 0
Accepted
time: 6ms
memory: 34288kb
input:
8 10 1 1 2 2 3 3 4 4 5 5 6 6 7 8 8 7 1 2 2 4 3 4 1 3 4 5 4 6 5 6 6 7 6 8 7 8
output:
possible
result:
ok single line: 'possible'
Test #44:
score: 0
Accepted
time: 83ms
memory: 68748kb
input:
400000 0 1 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 49 50 50 51 51 52 ...
output:
possible
result:
ok single line: 'possible'
Test #45:
score: 0
Accepted
time: 59ms
memory: 68804kb
input:
400000 0 1 2 2 1 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 49 50 50 51 51 52 ...
output:
impossible
result:
ok single line: 'impossible'
Test #46:
score: 0
Accepted
time: 134ms
memory: 84320kb
input:
399999 399999 1 2 2 3 3 1 2 3 3 4 4 2 3 4 4 5 5 3 4 5 5 6 6 4 5 6 6 7 7 5 6 7 7 8 8 6 7 8 8 9 9 7 8 9 9 10 10 8 9 10 10 11 11 9 10 11 11 12 12 10 11 12 12 13 13 11 12 13 13 14 14 12 13 14 14 15 15 13 14 15 15 16 16 14 15 16 16 17 17 15 16 17 17 18 18 16 17 18 18 19 19 17 18 19 19 20 20 18 19 20 20 2...
output:
possible
result:
ok single line: 'possible'
Test #47:
score: 0
Accepted
time: 138ms
memory: 112092kb
input:
400000 399999 1 2 2 1 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 49 50 50 51 5...
output:
impossible
result:
ok single line: 'impossible'
Test #48:
score: 0
Accepted
time: 169ms
memory: 151448kb
input:
399999 399998 1 2 2 1 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 49 50 50 51 5...
output:
impossible
result:
ok single line: 'impossible'
Test #49:
score: 0
Accepted
time: 105ms
memory: 137060kb
input:
400000 400000 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 ...
output:
impossible
result:
ok single line: 'impossible'
Test #50:
score: 0
Accepted
time: 143ms
memory: 184972kb
input:
400000 399999 1 2 2 1 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 49 50 50 51 5...
output:
impossible
result:
ok single line: 'impossible'
Test #51:
score: 0
Accepted
time: 111ms
memory: 137076kb
input:
400000 400000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1...
output:
possible
result:
ok single line: 'possible'
Test #52:
score: 0
Accepted
time: 145ms
memory: 127444kb
input:
266667 399999 2 1 1 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 49 50 50 51 5...
output:
impossible
result:
ok single line: 'impossible'
Test #53:
score: 0
Accepted
time: 114ms
memory: 120492kb
input:
266666 399999 2 1 1 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 49 50 50 51 5...
output:
possible
result:
ok single line: 'possible'
Test #54:
score: 0
Accepted
time: 110ms
memory: 121080kb
input:
266668 400000 1 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 49 50 50 51 5...
output:
possible
result:
ok single line: 'possible'
Extra Test:
score: 0
Extra Test Passed