QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412727#8225. 最小值之和do_while_true51 475ms9804kbC++203.7kb2024-05-16 18:39:462024-05-16 18:39:46

Judging History

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

  • [2024-05-16 18:39:46]
  • 评测
  • 测评结果:51
  • 用时:475ms
  • 内存:9804kb
  • [2024-05-16 18:39:46]
  • 提交

answer

#include<cstdio>
#include<vector>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<ctime>
#include<random>
#include<array>
#include<assert.h>
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n'
#define dpi(x,y) cerr<<"In Line "<<__LINE__<<" the "<<#x<<" = "<<x<<" ; "<<"the "<<#y<<" = "<<y<<'\n'
#define DE(fmt,...) fprintf(stderr, "Line %d : " fmt "\n",__LINE__,##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<ll,int>pli;
typedef pair<ll,ll>pll;
typedef pair<int,ll>pil;
typedef vector<int>vi;
typedef vector<ll>vll;
typedef vector<pii>vpii;
typedef vector<pll>vpll;
int cmax(int &x,int y){
	if(x<y){
		x=y;
		return 1;
	}
	return 0;
}
template<typename T>
T &read(T &r){
	r=0;bool w=0;char ch=getchar();
	while(ch<'0'||ch>'9')w=ch=='-'?1:0,ch=getchar();
	while(ch>='0'&&ch<='9')r=r*10+(ch^48),ch=getchar();
	return r=w?-r:r;
}
template<typename T1,typename... T2>
void read(T1 &x,T2& ...y){read(x);read(y...);}
const int mod=998244353;
inline void cadd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);}
inline void cdel(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);}
inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
inline int del(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
int qpow(int x,int y){
	int s=1;
	while(y){
		if(y&1)s=1ll*s*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return s;
}
const int N=81;
int n;
int a[N],b[N];
int f[N][N][N];
int pos[N][N][N],val[N][N][N];
int solve(int i,int j,int len1,int len2,int o){
	for(int w=0;w<o;w++)
		if(w%len1==i&&w%len2==j)
			return w;
	return 0x7fffffff;
}
void dfs(int l,int r,int k,int h){
	// DE("%d %d %d",l,r,k);
	if(l+1==r){
		b[l]=a[l]-k+h;
		return ;
	}
	if(pos[l][r][k%(r-l)]==l){
		b[l]=(a[l]-k)/(r-l)+h;
		dfs(l+1,r,k+(b[l]-h)*(r-l),b[l]);
		return ;
	}
	if(pos[l][r][k%(r-l)]==r){
		b[r-1]=(a[r]-k)/(r-l)+h;
		dfs(l,r-1,k+(b[r-1]-h)*(r-l),b[r-1]);
		return ;
	}
	int mid=pos[l][r][k%(r-l)];
	b[mid]=(f[l][r][k%(r-l)]-k)/(r-l)+h;
	dfs(l,mid,k+(b[mid]-h)*(r-l),b[mid]);
	dfs(mid+1,r,k+(b[mid]-h)*(r-l),b[mid]);
}
signed main(){
	#ifdef do_while_true
//		assert(freopen("data.in","r",stdin));
//		assert(freopen("data.out","w",stdout));
	#endif
	read(n);
	memset(f,-1,sizeof(f));
	for(int i=1;i<=n;i++)read(a[i]);
	if(n==1){
		if(a[1])puts("No");
		else puts("Yes");
		return 0;
	}
	for(int i=1;i<n;i++){
		if(a[i]==a[i+1])f[i][i+1][0]=a[i];
	}
	for(int len=3;len<=n;len++){
		for(int l=1;l+len-1<=n;l++){
			int r=l+len-1;
			for(int k=l;k<=r;k++){
				if(k==l){
					if(f[l+1][r][a[l]%(r-l-1)]>=a[l]){
						if(cmax(f[l][r][a[l]%(r-l)],a[l])){
							pos[l][r][a[l]%(r-l)]=l;
						}
					}
				}
				else if(k==r){
					if(f[l][r-1][a[r]%(r-l-1)]>=a[r])
						if(cmax(f[l][r][a[r]%(r-l)],a[r])){
							pos[l][r][a[r]%(r-l)]=r;
						}
				}
				else{
					int len1=k-l,len2=r-(k+1);
					for(int i=0;i<len1;i++)
						for(int j=0;j<len2;j++){
							int o=lcm(len1,len2);
							int t=solve(i,j,len1,len2,o);
							int up=min(f[l][k][i],f[k+1][r][j]);
							if(t<=up){
								t+=(up-t)/o*o;
								for(int p=0;p*o<=t;p++)
									if(cmax(f[l][r][(t-p*o)%(r-l)],t-p*o)){
										pos[l][r][(t-p*o)%(r-l)]=k;
									}
							}
						}
				}
			}
		}
	}
	if(f[1][n][0]==-1)puts("No");
	else{
		puts("Yes");
		dfs(1,n,0,0);
		for(int i=1;i<n;i++)cout<<b[i]<<' ';
		puts("");
	}
    #ifdef do_while_true
//		cerr<<'\n'<<"Time:"<<1.0*clock()/CLOCKS_PER_SEC*1000<<" ms"<<'\n';
	#endif
	return 0;
}

詳細信息

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 7932kb

input:

5
14 14 12 13 13

output:

Yes
5 3 3 4 

result:

ok The answer is correct.

Test #2:

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

input:

5
4 4 7 7 4

output:

Yes
1 1 4 1 

result:

ok The answer is correct.

Test #3:

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

input:

5
4 13 14 14 13

output:

Yes
1 4 5 4 

result:

ok The answer is correct.

Test #4:

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

input:

5
11 11 10 5 5

output:

Yes
5 4 1 2 

result:

ok The answer is correct.

Test #5:

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

input:

5
10 10 10 4 4

output:

Yes
4 4 1 1 

result:

ok The answer is correct.

Test #6:

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

input:

5
20 20 17 7 4

output:

Yes
10 7 2 1 

result:

ok The answer is correct.

Test #7:

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

input:

5
12 12 16 19 19

output:

Yes
3 3 5 8 

result:

ok The answer is correct.

Test #8:

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

input:

5
2 2 6 11 11

output:

Yes
2 0 3 8 

result:

ok The answer is correct.

Test #9:

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

input:

5
10 10 8 5 5

output:

Yes
5 3 1 2 

result:

ok The answer is correct.

Test #10:

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

input:

5
24 24 28 28 26

output:

Yes
6 6 9 7 

result:

ok The answer is correct.

Test #11:

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

input:

5
5 5 22 31 31

output:

Yes
2 1 10 19 

result:

ok The answer is correct.

Test #12:

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

input:

5
8 33 38 38 29

output:

Yes
2 11 16 9 

result:

ok The answer is correct.

Test #13:

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

input:

5
16 16 4 12 12

output:

Yes
13 1 1 9 

result:

ok The answer is correct.

Test #14:

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

input:

5
29 29 24 26 26

output:

Yes
11 6 6 8 

result:

ok The answer is correct.

Test #15:

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

input:

5
0 33 33 32 32

output:

Yes
0 13 10 12 

result:

ok The answer is correct.

Test #16:

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

input:

5
20 16 8 25 22

output:

No

result:

ok The answer is correct.

Test #17:

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

input:

5
0 2 3 0 2

output:

No

result:

ok The answer is correct.

Test #18:

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

input:

5
28 23 29 29 24

output:

No

result:

ok The answer is correct.

Test #19:

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

input:

5
0 1 0 4 2

output:

No

result:

ok The answer is correct.

Test #20:

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

input:

5
12 21 21 13 4

output:

No

result:

ok The answer is correct.

Test #21:

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

input:

5
9 22 25 23 12

output:

No

result:

ok The answer is correct.

Test #22:

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

input:

5
6 7 7 6 6

output:

Yes
2 3 1 3 

result:

ok The answer is correct.

Test #23:

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

input:

5
25 25 24 20 20

output:

Yes
8 7 5 5 

result:

ok The answer is correct.

Test #24:

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

input:

5
17 9 8 16 9

output:

No

result:

ok The answer is correct.

Test #25:

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

input:

5
20 5 34 34 23

output:

No

result:

ok The answer is correct.

Test #26:

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

input:

5
15 33 35 35 31

output:

No

result:

ok The answer is correct.

Test #27:

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

input:

5
21 22 23 1 18

output:

No

result:

ok The answer is correct.

Test #28:

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

input:

5
4 2 3 4 2

output:

No

result:

ok The answer is correct.

Test #29:

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

input:

5
16 25 8 19 7

output:

No

result:

ok The answer is correct.

Test #30:

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

input:

5
4 0 8 6 6

output:

No

result:

ok The answer is correct.

Test #31:

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

input:

2
2 3

output:

No

result:

ok The answer is correct.

Test #32:

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

input:

2
2 2

output:

Yes
2 

result:

ok The answer is correct.

Test #33:

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

input:

1
0

output:

Yes

result:

ok The answer is correct.

Test #34:

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

input:

1
233

output:

No

result:

ok The answer is correct.

Subtask #2:

score: 15
Accepted

Dependency #1:

100%
Accepted

Test #35:

score: 15
Accepted
time: 1ms
memory: 8360kb

input:

8
16 16 8 8 9 9 6 6

output:

Yes
16 0 4 1 5 1 2 

result:

ok The answer is correct.

Test #36:

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

input:

8
16 16 9 21 21 23 23 23

output:

Yes
10 1 2 14 1 9 9 

result:

ok The answer is correct.

Test #37:

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

input:

8
10 10 15 15 15 10 10 5

output:

Yes
10 0 6 6 1 6 1 

result:

ok The answer is correct.

Test #38:

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

input:

8
13 13 15 15 24 24 24 10

output:

Yes
7 1 9 1 9 9 2 

result:

ok The answer is correct.

Test #39:

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

input:

8
5 13 16 25 25 24 4 4

output:

Yes
1 3 4 9 8 0 4 

result:

ok The answer is correct.

Test #40:

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

input:

8
1313 1695 1695 1129 1129 711 557 557

output:

Yes
459 841 79 575 157 80 80 

result:

ok The answer is correct.

Test #41:

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

input:

8
1386 1416 1416 1069 1069 390 645 645

output:

Yes
554 584 56 735 56 55 315 

result:

ok The answer is correct.

Test #42:

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

input:

8
3377 3377 3164 3164 3570 3570 3365 3365

output:

Yes
665 452 452 452 724 519 519 

result:

ok The answer is correct.

Test #43:

score: 0
Accepted
time: 67ms
memory: 8888kb

input:

8
28167709 33181201 33829300 33829300 21924091 26145199 28398185 28398185

output:

Yes
5213219 7719965 8368064 3132013 3132013 5242567 7495553 

result:

ok The answer is correct.

Test #44:

score: 0
Accepted
time: 11ms
memory: 8588kb

input:

8
4726918 12793592 12793592 6681214 13995142 22020836 22566624 22566624

output:

Yes
675274 7113368 1000990 1000990 3438966 7451813 7997601 

result:

ok The answer is correct.

Test #45:

score: 0
Accepted
time: 171ms
memory: 7968kb

input:

8
9146297 15736298 15736298 16471005 16471005 14187656 14187656 6001415

output:

Yes
2429786 9019787 857345 11326935 857345 9043586 857345 

result:

ok The answer is correct.

Test #46:

score: 0
Accepted
time: 37ms
memory: 8164kb

input:

8
25115296 25115296 22120670 21035156 20603135 28703897 28703897 27553199

output:

Yes
6624695 3630069 3087312 2943305 2943305 7569035 6418337 

result:

ok The answer is correct.

Test #47:

score: 0
Accepted
time: 475ms
memory: 9192kb

input:

8
22440147 22440147 22626721 22626721 22592252 22592252 19174074 19174074

output:

Yes
6005229 2739153 6191803 2739153 6157332 2739154 2739154 

result:

ok The answer is correct.

Test #48:

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

input:

8
12 0 13 8 18 18 18 0

output:

No

result:

ok The answer is correct.

Test #49:

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

input:

8
3 23 13 18 26 12 25 25

output:

No

result:

ok The answer is correct.

Test #50:

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

input:

8
1353255 1004808 981534 1400692 1246708 409750 1177255 1177255

output:

No

result:

ok The answer is correct.

Test #51:

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

input:

8
96 96 99 99 4 94 39 36

output:

No

result:

ok The answer is correct.

Test #52:

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

input:

8
15 21 0 20 20 15 13 6

output:

No

result:

ok The answer is correct.

Test #53:

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

input:

8
2 1 0 2 6 6 5 1

output:

No

result:

ok The answer is correct.

Test #54:

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

input:

8
7 12 11 11 1 11 4 11

output:

No

result:

ok The answer is correct.

Test #55:

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

input:

8
18 3 27 27 19 10 6 6

output:

No

result:

ok The answer is correct.

Subtask #3:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #56:

score: 13
Accepted
time: 0ms
memory: 8716kb

input:

14
10 10 2 30 45 50 50 47 47 47 46 33 33 32

output:

Yes
9 1 0 3 8 12 9 3 12 11 3 5 4 

result:

ok The answer is correct.

Test #57:

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

input:

14
0 19 19 16 16 4 0 36 36 36 36 31 31 26

output:

Yes
0 19 0 14 2 0 0 16 4 16 4 10 5 

result:

ok The answer is correct.

Test #58:

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

input:

14
37 38 38 37 28 27 27 28 28 10 17 17 12 4

output:

Yes
10 11 10 7 0 27 0 28 0 3 9 4 1 

result:

ok The answer is correct.

Test #59:

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

input:

14
13 27 33 33 30 30 31 31 20 20 25 25 24 24

output:

Yes
1 8 14 1 18 1 13 2 2 2 5 3 4 

result:

ok The answer is correct.

Test #60:

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

input:

14
50 50 52 52 54 60 62 62 62 33 33 28 34 34

output:

Yes
26 2 28 2 9 11 12 12 2 9 2 3 9 

result:

ok The answer is correct.

Test #61:

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

input:

14
5123 5321 5321 5600 5600 5161 5537 5537 5359 4679 4679 4128 4128 3029

output:

Yes
1280 1478 233 2804 233 725 1002 824 561 571 233 1332 233 

result:

ok The answer is correct.

Test #62:

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

input:

14
340 2315 2315 2251 2251 1200 1366 1366 2831 2831 2864 2864 2812 2680

output:

Yes
27 2002 26 1165 112 113 279 112 569 406 528 476 410 

result:

ok The answer is correct.

Test #63:

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

input:

14
681 810 2276 2390 2390 1189 2424 2424 2031 1180 2548 2620 2620 221

output:

Yes
132 175 908 1022 17 157 971 578 154 154 838 910 17 

result:

ok The answer is correct.

Test #64:

score: -13
Time Limit Exceeded

input:

14
37026886 40993600 44483477 44483477 41071802 57414984 57414984 60000010 60000010 64898381 64898381 63120240 63120240 58440430

output:


result:


Subtask #4:

score: 25
Accepted

Dependency #1:

100%
Accepted

Test #77:

score: 25
Accepted
time: 386ms
memory: 7848kb

input:

49
28 28 28 24 37 37 33 36 36 29 43 43 41 41 29 48 51 51 44 49 50 50 9 9 15 18 18 3 17 17 9 13 17 17 13 13 0 6 6 16 21 25 25 19 7 19 19 17 4

output:

Yes
14 14 0 12 25 0 9 12 5 7 21 0 41 0 5 12 15 10 3 17 18 0 9 0 7 10 1 0 17 0 3 5 9 0 13 0 0 6 0 4 6 10 5 0 2 9 7 1 

result:

ok The answer is correct.

Test #78:

score: 0
Accepted
time: 391ms
memory: 9636kb

input:

49
3 3 29 29 31 31 34 34 34 34 31 22 22 21 21 21 36 36 37 42 42 41 22 22 6 6 19 37 65 71 71 77 78 78 76 76 42 46 46 40 60 60 60 60 60 60 6 6 4

output:

Yes
3 0 29 0 31 0 34 0 14 11 3 7 6 0 21 0 36 0 11 14 13 2 14 0 6 0 4 10 24 30 1 36 37 0 76 0 21 25 0 20 40 0 60 0 57 1 3 1 

result:

ok The answer is correct.

Test #79:

score: 0
Accepted
time: 390ms
memory: 9140kb

input:

49
18 18 18 16 16 59 61 64 64 57 57 78 78 78 78 81 92 92 92 92 89 81 47 64 64 63 59 65 65 63 52 52 34 34 33 8 13 13 17 17 14 16 19 19 13 13 18 18 18

output:

Yes
9 9 0 16 0 13 14 17 10 17 0 78 0 78 0 36 47 1 28 25 21 3 8 15 14 12 0 26 24 3 25 6 7 6 0 4 9 0 6 3 1 4 7 1 4 1 5 5 

result:

ok The answer is correct.

Test #80:

score: 0
Accepted
time: 449ms
memory: 9728kb

input:

50
43 47 47 42 42 41 51 51 57 62 62 61 58 58 67 67 68 68 63 68 68 67 71 71 76 76 76 76 76 76 48 48 48 48 36 36 33 33 4 8 8 6 6 11 11 3 3 10 10 10

output:

Yes
11 15 7 11 10 0 51 0 19 22 21 0 58 0 67 0 68 0 21 24 23 0 71 0 76 0 76 0 76 0 48 0 48 0 36 0 33 0 2 6 0 6 0 11 0 3 0 5 5 

result:

ok The answer is correct.

Test #81:

score: 0
Accepted
time: 389ms
memory: 7820kb

input:

49
12 14 14 16 16 10 18 32 32 30 30 0 0 5 5 4 0 9 9 18 18 18 30 41 43 43 39 39 35 24 26 27 27 6 6 13 13 19 22 22 21 21 44 44 43 43 33 33 31

output:

Yes
6 8 0 16 0 2 4 10 8 8 0 0 0 3 2 0 0 9 0 9 9 0 5 9 11 6 10 6 0 8 9 10 0 6 0 1 1 4 7 1 2 2 20 3 16 4 6 4 

result:

ok The answer is correct.

Test #82:

score: 0
Accepted
time: 334ms
memory: 9368kb

input:

48
13 13 11 3 36 40 40 40 36 35 35 30 18 18 33 33 33 23 20 20 17 19 20 20 0 10 31 31 28 30 30 5 16 16 13 12 12 36 39 39 37 37 25 25 26 26 7 7

output:

Yes
7 5 1 0 9 11 11 9 0 20 15 0 14 1 12 12 7 0 7 4 3 5 6 0 0 5 26 0 14 16 0 1 7 4 2 5 0 18 21 0 31 1 19 1 20 1 1 

result:

ok The answer is correct.

Test #83:

score: 0
Accepted
time: 386ms
memory: 8184kb

input:

49
72 72 71 33 98 98 89 89 174 174 163 163 170 170 82 98 98 202 202 179 164 282 299 299 316 316 300 262 250 250 236 154 140 148 150 150 148 148 131 95 95 106 106 108 108 81 78 78 51

output:

Yes
31 30 11 0 55 1 46 1 131 1 120 1 127 1 20 36 1 63 40 4 18 77 94 5 83 67 48 7 67 53 12 5 9 13 15 6 23 6 1 52 1 57 2 44 17 2 29 2 

result:

ok The answer is correct.

Test #84:

score: 0
Accepted
time: 449ms
memory: 8868kb

input:

50
148 360 360 392 392 399 399 384 350 350 346 346 306 306 314 314 346 346 323 321 174 293 299 304 342 342 340 328 328 227 227 192 330 339 339 318 327 327 326 266 266 182 204 204 67 67 79 79 85 85

output:

Yes
18 230 14 83 75 90 75 1 302 1 298 1 258 1 266 1 86 63 62 13 8 27 28 29 43 41 35 35 10 54 19 1 134 143 2 86 91 90 2 202 2 60 82 2 3 2 7 6 13 

result:

ok The answer is correct.

Test #85:

score: 0
Accepted
time: 339ms
memory: 9220kb

input:

48
200 224 224 200 267 267 259 231 246 246 215 215 196 184 180 180 270 270 270 234 230 233 233 186 114 165 165 160 190 212 212 243 243 239 239 143 143 162 162 262 264 264 246 234 238 238 22 22

output:

Yes
100 124 0 17 47 39 22 25 40 7 40 21 15 9 23 9 47 47 29 11 35 38 13 0 57 108 0 29 37 59 36 91 1 220 1 124 1 143 1 49 51 41 37 36 44 1 3 

result:

ok The answer is correct.

Test #86:

score: 0
Accepted
time: 391ms
memory: 7944kb

input:

49
226 226 216 196 196 158 193 253 253 257 257 257 201 300 300 320 384 392 392 385 385 263 291 291 269 287 287 277 277 487 487 497 497 496 482 507 511 511 503 331 152 173 189 214 214 232 232 221 191

output:

Yes
49 39 3 48 10 3 14 74 12 46 46 3 10 33 29 37 69 77 8 167 45 3 150 3 20 38 10 16 12 181 17 49 48 39 40 49 53 47 18 3 4 7 11 36 9 37 26 11 

result:

ok The answer is correct.

Test #87:

score: 0
Accepted
time: 391ms
memory: 8188kb

input:

49
247 247 231 383 383 381 379 398 398 397 391 195 200 227 227 197 197 339 339 337 344 344 379 388 388 379 343 405 405 412 412 402 402 412 412 398 398 415 430 430 382 382 384 384 341 198 122 124 124

output:

Yes
153 2 47 124 122 2 63 71 70 67 17 10 30 57 2 103 2 245 2 40 47 35 51 60 51 39 2 311 2 318 2 308 2 304 3 226 10 73 88 31 76 33 77 34 12 4 3 16 

result:

ok The answer is correct.

Test #88:

score: 0
Accepted
time: 335ms
memory: 8384kb

input:

48
196 196 284 284 280 280 263 303 387 387 388 388 343 321 321 328 328 283 283 151 157 157 164 164 198 203 203 172 166 178 259 280 294 294 288 243 239 239 235 226 226 330 333 333 302 287 295 295

output:

Yes
58 3 146 3 142 3 22 42 126 16 91 46 35 35 3 190 3 145 3 8 14 3 26 3 20 25 7 5 5 7 24 31 41 35 20 4 48 44 3 18 13 43 46 29 24 24 32 

result:

ok The answer is correct.

Test #89:

score: 0
Accepted
time: 336ms
memory: 7792kb

input:

48
244 256 256 248 253 253 269 269 250 229 229 67 252 322 261 116 372 271 372 322 333 333 393 429 429 428 347 319 294 387 234 352 370 370 317 37 193 398 10 76 215 222 222 208 344 145 171 87

output:

No

result:

ok The answer is correct.

Test #90:

score: 0
Accepted
time: 441ms
memory: 8288kb

input:

50
34 15 33 66 66 66 33 39 9 35 55 29 34 35 51 13 50 50 56 48 44 43 57 57 57 25 50 50 27 27 21 47 35 50 50 55 55 53 7 43 37 55 55 62 62 62 52 21 26 26

output:

No

result:

ok The answer is correct.

Test #91:

score: 0
Accepted
time: 386ms
memory: 9432kb

input:

49
47 64 64 64 59 74 74 3 72 19 67 71 25 61 61 58 50 49 49 58 62 70 70 69 51 70 62 62 62 62 62 54 8 41 41 41 19 40 40 20 8 24 24 20 16 16 16 19 19

output:

No

result:

ok The answer is correct.

Test #92:

score: 0
Accepted
time: 338ms
memory: 8724kb

input:

48
13 13 10 27 27 28 28 18 29 29 26 24 31 31 30 26 12 12 0 0 0 42 42 38 38 38 37 37 27 27 26 60 60 68 70 70 67 67 70 70 67 67 48 49 49 47 47 44

output:

Yes
13 0 5 22 0 19 9 0 12 9 8 0 11 10 8 1 8 0 0 0 0 17 1 7 7 1 12 1 2 1 1 20 2 15 17 2 27 2 30 2 27 2 5 6 2 6 3 

result:

ok The answer is correct.

Test #93:

score: 0
Accepted
time: 448ms
memory: 9296kb

input:

50
22 22 14 24 27 27 25 25 10 47 47 45 41 42 42 44 44 43 43 0 32 32 30 27 27 10 10 14 14 14 4 11 11 9 23 23 20 28 28 22 29 31 1 28 30 30 30 30 27 27

output:

No

result:

ok The answer is correct.

Test #94:

score: 0
Accepted
time: 386ms
memory: 8056kb

input:

49
45 69 69 73 73 73 69 69 34 34 31 47 51 54 54 58 58 56 56 53 42 42 10 10 4 7 7 60 61 61 63 63 64 66 66 62 34 49 49 49 46 40 38 43 43 13 13 10 10

output:

No

result:

ok The answer is correct.

Test #95:

score: 0
Accepted
time: 338ms
memory: 8408kb

input:

48
17 17 16 16 0 27 29 32 32 36 36 39 39 35 33 21 23 23 46 46 46 46 38 38 36 36 34 34 31 33 33 36 36 30 30 28 28 23 19 19 33 37 37 15 38 39 39 0

output:

No

result:

ok The answer is correct.

Test #96:

score: 0
Accepted
time: 390ms
memory: 9400kb

input:

49
18 25 25 24 30 31 31 32 32 31 27 43 43 48 48 53 53 51 39 48 48 47 47 11 11 53 28 24 24 23 21 24 24 24 24 19 38 39 39 38 38 39 42 42 41 36 39 39 37

output:

No

result:

ok The answer is correct.

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%