QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218209#6550. Elimination RacezhouhuanyiTL 699ms13016kbC++143.8kb2023-10-17 20:33:532023-10-17 20:33:53

Judging History

你现在查看的是最新测评结果

  • [2023-10-17 20:33:53]
  • 评测
  • 测评结果:TL
  • 用时:699ms
  • 内存:13016kb
  • [2023-10-17 20:33:53]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<vector>
#include<cstring>
#include<random>
#include<algorithm>
#define N 500
#define SM 1000
#define K 2000000
#define rg register
using namespace std;
mt19937 RAND(random_device{}());
const int inf=(int)(1e9);
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
namespace HK
{
	const int Max_N(1005), Inf(1 << 30);
	int Nl, Nr, M, now, dis;
	int matchl[Max_N], matchr[Max_N], levell[Max_N], levelr[Max_N], visited[Max_N];
	int E[Max_N][Max_N], degree[Max_N];
	void clear()
	{
		Nl=Nr=M=now=dis=0;
		for (int i=0;i<Max_N;++i) matchl[i]=matchr[i]=levell[i]=levelr[i]=visited[i]=degree[i]=0;
		for (int i=0;i<Max_N;++i)
			for (int j=0;j<Max_N;++j)
				E[i][j]=0;
		return;
	}
	bool bfs()
	{
		static int queue[Max_N];
		for (int i=0;i<Max_N;++i) queue[i]=0;
		int* begin(queue);
		int* end(queue);
		bool res(false);
		for (int i(1); i <= Nl; ++i)
			if (matchl[i])
				levell[i] = 0;
			else
				levell[i] = 1, *end++ = i;
		for (int i(1); i <= Nr; ++i)
			levelr[i] = 0;
		while (begin != end)
		{
			int u(*begin++);
			for (int* e(E[u]); *e; ++e)
				if (levelr[*e] == 0)
				{
					levelr[*e] = levell[u] + 1;
					if (matchr[*e])
					{
						levell[matchr[*e]] = levelr[*e] + 1;
						*end++ = matchr[*e];
					}
					else
						res = true;
				}
		}
		return res;
	}

	bool dfs(int u)
	{
		for (int* e(E[u]); *e; ++e)
			if (levelr[*e] == levell[u] + 1 && visited[*e] != now)
			{
				visited[*e] = now;
				if (matchr[*e] == 0 || dfs(matchr[*e]))
				{
					matchr[*e] = u, matchl[u] = *e;
					return true;
				}
			}
		return false;
	}

	inline int HK()
	{
		int res(0);
		while (bfs())
		{
			++now;
			for (int i(1); i <= Nl; ++i)
				if (!matchl[i])
					res += dfs(i);
		}
		return res;
	}
}
struct node
{
	int v,data,nxt;
};
node edge[K+1];
int n,s,t,len,leng,tong[N+1],ps[N+1],cl[N+1],depth[SM+1],head[SM+1],cur[SM+1],rt[N+1],in[N+1],p[N+1],sp[N+1],a[N+1][N+1],rk[N+1][N+1];
bool used[SM+1],vis[SM+1];
void add(int x,int y,int z)
{
	edge[++len]=(node){y,z,head[x]},head[x]=len;
	edge[++len]=(node){x,0,head[y]},head[y]=len;
	return;
}
void topo_sort()
{
	int top;
	queue<int>q;
	for (int i=1;i<=n-1;++i) in[i]=0;
	for (int i=1;i<=n-1;++i)
		for (int j=1;j<=n-1;++j)
			if (rk[j][sp[i]]>rk[j][sp[j]])
				in[j]++;
	for (int i=1;i<=n-1;++i)
		if (!in[i])
			q.push(i);
	while (!q.empty())
	{
		top=q.front(),q.pop(),tong[++leng]=top;
		for (int i=1;i<=n;++i)
			if (top!=i&&rk[i][sp[top]]>rk[i][sp[i]])
			{
				in[i]--;
				if (!in[i]) q.push(i);
			}
	}
	return;
}
int main()
{
	int flow,res,x,y;
	n=read();
	for (int i=1;i<=n-1;++i)
		for (int j=1;j<=n;++j)
			a[i][j]=read(),rk[i][a[i][j]]=j;
	for (int i=1;i<=n;++i)
	{
		HK::clear(),HK::Nl=n-1,HK::Nr=n,res=leng=0;
		for (int j=1;j<=n-1;++j)
		{
			for (int k=rk[j][i]+1;k<=n;++k) HK::E[j][HK::degree[j]++]=a[j][k];
			shuffle(HK::E[j],HK::E[j]+HK::degree[j],RAND);
		}
		res=HK::HK();
		if (res==n-1)
		{
			puts("Yes");
			for (int j=1;j<=n-1;++j) p[HK::matchl[j]]=j;
			for (int j=1;j<=(n<<1);++j) vis[j]=0;
			for (int j=1;j<=n-1;++j) ps[j]=n;
			while (1)
			{
				x=0;
				for (int j=1;j<=n-1;++j)
					if (!vis[j])
					{
						x=j;
						break;
					}
				if (!x) break;
				for (int j=1;j<=n-1;++j)
					if (!vis[j])
					{
						while (vis[n-1+a[j][ps[j]]]) ps[j]--;
						cl[j]=a[j][ps[j]];
					}
				for (int j=1;j<=n-1;++j) used[j]=0;
				while (!used[x]) used[x]=1,x=p[cl[x]];
				y=x;
				do
				{
					sp[y]=cl[y],vis[y]=vis[n-1+cl[y]]=1,y=p[cl[y]];
				}
				while (x!=y);
			}
			topo_sort();
			for (int j=1;j<=n-1;++j) printf("%d ",tong[j]);
			puts("");
		}
		else puts("No");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 10568kb

input:

4
1 2 3 4
2 1 3 4
4 3 1 2

output:

Yes
2 3 1 
No
No
No

result:

ok n=4, yes=1, no=3

Test #2:

score: 0
Accepted
time: 2ms
memory: 9832kb

input:

3
2 1 3
2 1 3

output:

No
Yes
2 1 
No

result:

ok n=3, yes=1, no=2

Test #3:

score: 0
Accepted
time: 1ms
memory: 10100kb

input:

2
1 2

output:

Yes
1 
No

result:

ok n=2, yes=1, no=1

Test #4:

score: 0
Accepted
time: 0ms
memory: 11536kb

input:

2
2 1

output:

No
Yes
1 

result:

ok n=2, yes=1, no=1

Test #5:

score: 0
Accepted
time: 3ms
memory: 10488kb

input:

11
4 3 6 1 11 10 5 7 8 9 2
11 6 5 1 10 3 8 2 7 9 4
5 9 2 11 3 4 1 10 8 6 7
9 11 8 3 5 4 1 6 7 10 2
3 9 7 6 5 10 1 4 11 8 2
8 2 4 1 5 9 3 7 6 10 11
3 8 2 9 1 4 5 10 11 6 7
10 11 4 1 7 5 2 6 8 9 3
10 6 9 3 2 1 4 8 11 7 5
8 11 9 1 4 10 2 5 3 7 6

output:

Yes
2 5 6 7 8 9 10 1 4 3 
No
No
No
No
No
No
Yes
2 5 6 7 8 9 1 4 3 10 
Yes
1 2 3 6 8 10 4 7 9 5 
Yes
2 3 4 6 8 7 1 5 10 9 
No

result:

ok n=11, yes=4, no=7

Test #6:

score: 0
Accepted
time: 0ms
memory: 11724kb

input:

11
6 7 8 9 3 4 1 11 5 10 2
7 10 6 3 1 2 5 11 4 9 8
4 3 9 1 10 2 5 7 6 8 11
10 4 2 11 8 1 5 7 9 6 3
11 9 4 6 8 2 1 7 3 5 10
9 10 2 7 4 11 6 1 3 8 5
11 8 4 9 7 1 2 10 5 3 6
5 7 9 10 1 8 4 2 6 11 3
4 2 9 7 10 1 6 8 3 5 11
2 7 6 10 5 11 1 8 4 9 3

output:

Yes
1 4 5 6 7 8 10 9 2 3 
No
No
Yes
1 2 3 5 7 8 9 10 6 4 
No
No
Yes
1 2 3 4 5 6 7 10 8 9 
No
Yes
2 10 4 8 7 3 6 9 5 1 
No
No

result:

ok n=11, yes=4, no=7

Test #7:

score: 0
Accepted
time: 3ms
memory: 11208kb

input:

11
3 5 9 7 4 1 8 11 10 2 6
9 7 10 4 8 3 1 6 5 2 11
9 5 11 3 8 7 1 6 2 4 10
8 9 11 1 4 3 10 6 7 2 5
11 3 7 8 5 9 1 2 10 6 4
8 3 10 11 1 4 2 5 6 7 9
5 9 10 2 4 3 7 1 11 6 8
11 8 10 3 5 7 4 1 2 6 9
7 8 1 9 10 5 3 11 2 6 4
2 4 6 9 5 11 7 1 8 10 3

output:

Yes
1 2 3 4 7 8 9 10 6 5 
No
No
No
No
No
Yes
1 2 3 4 6 7 9 10 8 5 
No
No
No
No

result:

ok n=11, yes=2, no=9

Test #8:

score: 0
Accepted
time: 3ms
memory: 11640kb

input:

11
3 5 9 2 11 1 4 8 6 10 7
8 3 4 9 1 5 6 2 7 10 11
10 6 4 7 11 9 1 3 5 8 2
9 3 2 7 8 4 5 10 1 11 6
3 4 9 10 1 8 2 7 6 11 5
9 4 7 8 1 11 6 3 5 2 10
5 11 4 10 6 3 2 1 9 8 7
10 11 8 5 2 1 9 7 4 6 3
6 3 8 9 4 11 1 2 10 7 5
8 3 11 10 9 1 6 5 7 2 4

output:

Yes
2 3 4 6 8 9 10 5 1 7 
No
No
No
No
No
No
Yes
3 5 6 7 8 10 1 9 4 2 
Yes
1 2 3 4 5 6 8 10 7 9 
No
No

result:

ok n=11, yes=3, no=8

Test #9:

score: 0
Accepted
time: 0ms
memory: 10372kb

input:

11
3 5 7 10 9 6 2 1 11 8 4
3 6 1 7 5 11 4 10 9 8 2
10 4 6 7 11 3 1 2 9 5 8
10 4 1 9 11 5 3 8 6 7 2
11 5 9 1 10 4 8 6 7 2 3
3 2 7 9 11 10 1 5 8 4 6
4 5 11 8 6 7 10 1 2 3 9
2 7 3 11 8 1 9 6 4 10 5
4 8 2 7 5 10 6 1 11 3 9
9 6 3 5 1 10 11 7 8 4 2

output:

Yes
1 3 6 7 9 5 10 4 8 2 
No
No
No
No
No
Yes
4 5 6 8 2 10 3 1 9 7 
No
No
Yes
1 3 5 6 8 10 2 4 7 9 
Yes
1 6 8 9 10 7 2 4 3 5 

result:

ok n=11, yes=4, no=7

Test #10:

score: 0
Accepted
time: 3ms
memory: 10704kb

input:

11
6 5 11 2 8 9 7 10 1 4 3
11 4 3 6 10 7 9 1 8 5 2
3 2 6 8 5 7 9 1 10 4 11
11 6 9 1 3 10 4 2 7 8 5
5 6 8 7 11 9 1 3 4 2 10
6 5 3 9 2 1 10 11 8 4 7
9 3 4 6 2 1 5 7 8 10 11
11 6 9 8 1 4 3 2 5 10 7
6 4 7 11 3 2 1 5 8 10 9
10 3 8 6 4 1 11 7 9 2 5

output:

No
No
No
Yes
1 2 3 5 6 9 8 4 10 7 
No
Yes
1 2 5 7 8 9 10 3 6 4 
No
Yes
1 2 4 6 7 9 8 3 5 10 
No
No
No

result:

ok n=11, yes=3, no=8

Test #11:

score: 0
Accepted
time: 3ms
memory: 10112kb

input:

11
10 5 4 6 11 1 3 7 9 8 2
2 8 10 4 6 1 7 9 3 11 5
5 7 11 8 3 1 9 2 4 10 6
5 6 11 10 3 1 2 9 8 4 7
6 3 4 9 11 5 1 2 8 10 7
8 7 6 1 10 3 5 11 9 4 2
5 11 9 4 6 2 7 1 8 3 10
10 11 2 1 9 4 3 5 8 6 7
9 3 4 6 5 1 11 8 2 7 10
7 10 4 5 9 6 8 1 3 11 2

output:

Yes
1 3 5 7 6 4 8 9 10 2 
No
Yes
7 10 9 1 6 8 3 4 5 2 
Yes
3 4 6 9 1 10 7 5 8 2 
No
No
No
Yes
1 2 5 9 10 4 8 7 6 3 
Yes
2 4 6 9 8 1 10 7 3 5 
No
Yes
2 5 9 10 4 8 7 1 6 3 

result:

ok n=11, yes=6, no=5

Test #12:

score: 0
Accepted
time: 3ms
memory: 11108kb

input:

11
7 8 4 5 1 3 6 9 11 10 2
8 10 9 7 1 3 5 4 2 11 6
4 11 9 5 3 1 2 10 8 6 7
9 6 7 1 3 8 2 4 10 5 11
9 3 10 2 4 1 6 7 5 11 8
9 3 1 7 2 6 5 8 11 4 10
2 4 9 3 1 5 11 6 7 8 10
3 4 11 10 8 6 1 5 2 7 9
4 11 7 6 8 1 10 9 3 5 2
8 7 4 9 10 3 1 5 2 6 11

output:

Yes
2 3 5 7 8 9 10 6 1 4 
No
Yes
2 3 4 5 7 9 6 1 10 8 
Yes
1 2 3 4 6 8 10 7 9 5 
Yes
4 5 6 8 9 10 7 1 2 3 
No
No
No
No
No
No

result:

ok n=11, yes=4, no=7

Test #13:

score: 0
Accepted
time: 3ms
memory: 11260kb

input:

11
4 8 10 9 6 3 1 5 2 7 11
10 8 7 4 9 1 6 11 3 2 5
3 10 11 6 1 4 5 2 7 9 8
4 9 8 3 1 6 11 7 5 2 10
8 2 11 7 3 1 5 6 10 4 9
4 9 3 6 5 1 7 10 11 2 8
4 3 6 7 1 5 8 2 9 11 10
10 7 4 1 9 8 2 3 6 11 5
10 7 2 8 5 1 11 6 4 3 9
7 6 9 8 1 11 5 4 2 3 10

output:

Yes
1 6 7 8 3 10 2 5 4 9 
Yes
2 4 6 7 10 3 1 8 9 5 
Yes
2 3 9 10 8 5 7 4 1 6 
Yes
2 3 5 10 8 9 7 6 1 4 
No
Yes
1 4 8 9 10 2 5 7 6 3 
Yes
1 3 4 8 6 7 5 9 2 10 
No
No
No
No

result:

ok n=11, yes=6, no=5

Test #14:

score: 0
Accepted
time: 3ms
memory: 11472kb

input:

11
8 5 9 7 6 1 10 4 2 3 11
3 6 5 11 9 7 1 2 4 10 8
2 11 3 8 1 6 7 5 4 10 9
7 5 8 6 4 9 1 2 3 10 11
6 7 8 1 2 3 11 9 10 5 4
7 4 10 9 1 2 8 5 11 3 6
10 7 5 6 11 3 1 2 9 4 8
5 2 6 8 10 1 9 3 4 7 11
5 7 3 11 8 2 1 6 9 4 10
2 3 10 4 1 11 5 7 8 9 6

output:

Yes
2 6 8 9 7 10 1 5 4 3 
Yes
2 4 5 6 1 8 7 3 10 9 
Yes
1 6 7 4 8 10 3 2 5 9 
No
Yes
1 5 6 7 8 10 3 2 4 9 
No
Yes
2 3 8 10 7 1 4 5 9 6 
No
No
No
No

result:

ok n=11, yes=5, no=6

Test #15:

score: 0
Accepted
time: 622ms
memory: 10704kb

input:

500
446 156 267 294 482 398 430 13 311 318 474 426 140 484 83 387 257 136 69 305 295 283 287 55 52 65 322 249 43 56 331 443 226 214 341 182 389 464 84 477 187 40 327 411 248 10 223 165 379 293 12 9 5 230 309 367 2 397 265 59 361 118 196 316 390 213 194 167 483 452 114 345 263 219 87 94 160 224 200 2...

output:

Yes
1 2 4 5 6 8 19 20 21 22 23 24 27 29 31 33 35 36 39 40 41 42 43 44 46 47 48 49 54 56 57 58 59 61 62 64 65 66 67 69 71 76 77 80 81 82 83 87 88 89 90 91 93 94 96 98 101 103 104 106 113 114 116 117 118 119 125 128 129 131 133 134 135 136 137 138 144 145 146 147 150 151 152 154 156 157 160 161 162 16...

result:

ok n=500, yes=171, no=329

Test #16:

score: 0
Accepted
time: 643ms
memory: 12748kb

input:

500
18 271 51 335 212 326 93 264 408 66 230 181 456 149 259 396 269 443 136 446 250 409 240 457 319 289 402 334 247 216 106 214 468 448 58 186 137 225 337 487 281 333 130 275 169 420 100 71 57 284 63 454 108 375 164 437 133 110 440 350 479 370 276 211 193 148 198 222 496 460 308 85 286 242 257 435 4...

output:

Yes
1 3 4 6 7 9 10 12 13 14 18 21 22 29 30 31 34 35 36 39 42 47 51 54 55 58 61 66 69 72 79 86 88 89 90 93 94 95 96 99 105 106 109 110 119 120 121 124 130 134 135 138 141 143 144 145 146 150 152 155 156 157 158 160 163 167 168 170 172 173 174 176 177 178 185 188 189 190 191 192 193 194 197 200 202 20...

result:

ok n=500, yes=185, no=315

Test #17:

score: 0
Accepted
time: 636ms
memory: 12656kb

input:

500
24 261 411 242 116 202 460 6 169 140 268 333 447 468 341 373 58 274 175 180 77 232 465 326 300 211 204 75 98 425 322 90 408 489 227 480 89 31 94 248 334 299 76 290 157 178 111 143 103 117 131 292 456 201 118 285 150 10 56 251 418 448 453 47 451 184 343 42 210 68 113 422 165 391 415 272 45 82 490...

output:

Yes
2 3 5 7 8 9 11 12 13 14 18 19 20 21 23 24 28 29 30 31 32 34 38 39 40 43 45 47 48 52 53 55 57 59 62 68 70 77 79 80 81 84 87 90 91 92 93 95 100 101 104 107 109 110 112 113 114 116 119 120 123 124 125 129 135 136 137 139 143 146 147 151 155 157 162 163 166 167 168 172 173 174 175 176 178 182 183 18...

result:

ok n=500, yes=186, no=314

Test #18:

score: 0
Accepted
time: 658ms
memory: 13016kb

input:

500
219 142 183 492 426 414 85 228 482 93 21 361 327 345 234 50 432 52 498 223 372 127 319 56 263 210 204 43 394 271 22 437 419 486 186 255 398 167 353 444 371 172 23 270 235 133 189 6 279 380 97 179 2 29 277 328 149 411 158 369 298 26 489 315 107 360 160 463 109 215 81 232 448 140 355 33 82 25 125 ...

output:

Yes
1 2 4 5 9 10 12 13 14 15 16 19 20 21 22 23 24 29 31 33 34 35 40 41 44 46 48 52 53 55 56 58 59 61 63 64 66 67 72 73 74 75 76 77 79 80 83 84 89 91 92 96 97 100 101 102 103 106 108 109 110 116 118 119 122 123 124 126 128 129 131 137 141 142 144 145 147 150 152 159 160 161 162 164 169 170 173 174 17...

result:

ok n=500, yes=188, no=312

Test #19:

score: 0
Accepted
time: 642ms
memory: 12940kb

input:

500
330 206 369 65 187 249 174 325 166 260 55 244 351 275 118 186 434 116 489 481 331 472 112 130 297 26 16 84 321 132 484 305 188 35 287 452 109 44 180 407 374 46 221 29 246 424 208 292 285 209 414 418 33 406 223 309 422 108 56 359 296 326 49 286 217 173 120 72 322 62 204 451 81 455 179 45 284 298 ...

output:

Yes
3 4 6 8 9 10 11 12 13 18 19 22 23 27 28 30 33 35 38 39 41 42 43 44 45 49 54 56 57 58 59 60 61 63 64 69 70 71 74 77 78 79 80 81 83 86 90 91 92 95 96 99 101 102 103 104 105 106 107 108 109 110 111 114 119 121 124 126 128 132 134 135 139 142 143 146 147 149 150 153 154 156 157 158 160 163 164 165 1...

result:

ok n=500, yes=175, no=325

Test #20:

score: 0
Accepted
time: 630ms
memory: 12660kb

input:

500
233 154 203 96 30 404 476 284 75 447 291 52 155 197 258 500 338 278 199 20 405 408 307 108 122 368 424 308 453 26 7 94 330 177 319 407 105 179 236 337 150 315 29 345 292 471 89 456 180 483 382 466 45 485 263 376 478 53 61 34 463 327 219 472 62 84 172 443 226 432 190 63 366 276 174 168 375 147 19...

output:

Yes
2 4 5 6 7 14 15 16 18 19 20 23 24 26 28 29 35 39 40 41 42 47 48 50 53 57 58 59 62 64 65 66 69 70 71 75 78 79 80 82 87 89 91 92 94 97 98 99 100 102 105 106 111 112 114 115 116 118 122 124 125 126 130 131 132 134 135 137 138 140 141 142 144 145 146 147 149 150 151 152 153 154 157 158 159 160 162 1...

result:

ok n=500, yes=182, no=318

Test #21:

score: 0
Accepted
time: 618ms
memory: 10608kb

input:

500
147 88 258 111 242 490 363 484 137 17 81 260 58 113 14 50 286 333 479 419 398 240 309 301 210 289 296 83 357 120 9 288 459 232 146 239 426 319 3 171 247 348 207 412 233 32 116 480 56 115 492 218 331 209 86 174 16 101 350 176 245 36 456 365 199 102 94 76 82 351 376 103 455 420 231 325 37 93 214 2...

output:

Yes
2 5 6 8 9 12 14 15 16 17 18 19 20 22 24 26 29 30 31 33 34 36 41 43 44 45 46 47 49 51 52 54 57 58 61 62 63 64 65 67 69 72 73 75 76 81 82 83 85 86 91 94 96 98 100 102 105 106 107 110 111 112 113 115 116 118 120 122 123 126 127 128 129 130 131 135 136 137 139 142 143 144 146 148 150 153 154 156 157...

result:

ok n=500, yes=180, no=320

Test #22:

score: 0
Accepted
time: 625ms
memory: 10864kb

input:

500
170 302 411 359 201 15 194 287 128 106 181 12 367 450 339 488 377 466 115 16 275 62 178 330 276 461 168 58 380 202 14 37 233 92 383 195 459 327 74 477 278 363 444 342 422 455 28 169 301 492 436 337 356 487 126 378 404 249 7 259 366 187 103 447 130 389 24 120 245 206 47 432 416 102 297 166 376 31...

output:

Yes
3 7 9 11 12 13 18 19 20 23 25 26 27 29 32 33 36 37 40 44 45 46 47 53 54 55 56 57 59 61 68 69 70 72 73 76 79 82 83 84 86 87 88 90 92 93 94 95 97 98 101 103 105 109 110 111 112 114 117 118 119 124 125 126 134 135 136 137 140 141 143 145 148 149 150 151 152 154 155 156 159 160 165 166 167 168 171 1...

result:

ok n=500, yes=174, no=326

Test #23:

score: 0
Accepted
time: 627ms
memory: 10612kb

input:

500
498 451 475 72 77 397 157 119 386 312 321 45 71 21 24 438 186 26 341 408 39 195 275 366 100 144 70 95 246 4 46 361 182 155 473 387 23 335 6 413 292 416 89 266 2 457 450 213 367 22 92 382 237 170 251 500 254 309 136 323 27 42 222 481 111 169 188 371 166 150 434 427 208 209 398 430 165 295 238 258...

output:

Yes
2 4 5 6 12 18 20 22 23 26 27 32 33 34 37 39 40 42 46 47 50 51 55 56 59 62 63 64 65 68 74 75 77 78 79 80 82 84 88 89 90 95 98 99 100 101 102 105 106 107 110 111 112 113 115 116 117 118 121 122 127 128 131 132 134 135 136 137 139 142 143 144 145 147 148 149 157 158 161 162 167 168 171 173 174 175 ...

result:

ok n=500, yes=187, no=313

Test #24:

score: 0
Accepted
time: 640ms
memory: 12716kb

input:

500
74 364 86 239 403 250 29 92 464 201 114 394 231 279 59 217 343 242 225 255 48 154 404 103 183 18 159 147 137 222 75 172 458 362 39 99 396 149 100 428 259 318 53 460 76 163 146 444 342 184 143 296 262 186 148 175 165 241 294 218 254 482 16 488 169 78 27 101 311 63 14 258 117 60 393 107 410 145 10...

output:

Yes
1 4 5 7 8 9 11 14 15 17 19 21 24 25 26 27 29 31 32 33 34 35 36 37 39 42 44 47 48 52 54 55 58 60 61 62 63 64 66 67 69 72 73 74 76 77 78 82 86 87 89 92 96 97 98 99 101 102 103 104 108 111 112 113 114 115 117 121 123 124 125 127 129 131 132 136 138 139 140 143 144 147 148 152 158 159 160 161 162 16...

result:

ok n=500, yes=177, no=323

Test #25:

score: 0
Accepted
time: 699ms
memory: 12648kb

input:

500
468 261 329 368 419 490 308 362 265 282 392 397 306 281 384 325 263 319 448 449 277 333 323 394 351 472 442 260 374 400 274 264 423 278 369 380 403 303 406 470 295 318 326 268 371 339 491 390 444 481 421 459 393 347 383 408 257 324 286 267 253 436 483 460 427 320 388 297 287 363 288 358 361 331 ...

output:

No
Yes
2 3 5 6 10 12 13 14 16 20 21 22 24 26 27 28 31 33 37 42 43 51 53 55 57 58 60 61 62 63 64 65 66 67 69 70 71 74 75 77 82 85 87 89 94 95 97 98 100 102 105 106 107 110 112 113 114 118 120 122 123 124 129 131 133 139 140 141 143 144 146 148 150 151 153 158 159 163 164 165 168 170 171 172 173 174 1...

result:

ok n=500, yes=87, no=413

Test #26:

score: 0
Accepted
time: 698ms
memory: 10636kb

input:

500
346 259 341 335 407 440 269 460 405 413 356 437 309 286 275 390 347 359 447 298 473 264 326 378 279 289 409 484 371 282 397 424 362 368 414 293 387 367 450 401 366 363 466 464 418 382 376 291 433 276 428 448 474 377 393 451 348 495 499 491 386 478 485 302 380 395 481 425 446 271 420 372 469 370 ...

output:

No
No
Yes
1 3 5 7 8 14 16 17 23 24 26 27 29 32 38 39 40 42 43 44 47 48 50 53 54 57 59 62 63 66 67 69 71 72 75 76 79 80 81 83 84 85 86 87 88 89 90 92 93 94 95 97 98 103 106 107 110 111 113 116 117 119 120 121 122 123 125 128 130 133 137 139 142 147 148 150 151 154 155 156 157 158 159 161 163 165 166 ...

result:

ok n=500, yes=98, no=402

Test #27:

score: 0
Accepted
time: 698ms
memory: 12752kb

input:

500
69 243 142 67 116 127 204 25 27 219 81 233 78 83 118 121 200 177 232 111 240 194 144 249 89 45 133 39 76 155 145 174 57 181 32 85 239 129 238 109 44 53 241 157 140 91 173 135 9 182 236 11 176 18 163 117 169 87 130 137 138 202 29 248 228 171 206 185 74 122 215 178 13 154 21 50 37 147 180 183 43 1...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok n=500, yes=86, no=414

Test #28:

score: -100
Time Limit Exceeded

input:

500
53 194 137 190 150 36 201 181 43 75 221 232 27 135 108 122 104 54 141 145 238 12 100 142 171 73 230 218 234 244 249 187 156 90 5 22 125 89 40 16 88 130 61 186 92 114 185 188 149 205 167 222 209 69 38 8 45 159 157 241 26 175 94 155 184 50 80 110 197 39 162 200 182 78 215 52 59 31 95 112 169 161 1...

output:

No
Yes
3 5 7 9 11 12 15 16 20 21 22 24 26 27 29 32 33 34 37 42 44 45 46 47 48 51 52 54 56 58 61 64 67 68 69 70 71 74 75 77 79 82 83 84 85 86 87 90 93 95 96 100 101 102 103 104 105 106 107 109 110 112 113 116 117 122 123 125 130 135 136 137 140 142 145 147 148 151 154 156 157 158 159 162 164 165 168 ...

result: