QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#404609#8225. 最小值之和wxqwq#0 2ms3896kbC++141.1kb2024-05-04 10:38:592024-05-04 10:39:00

Judging History

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

  • [2024-05-04 10:39:00]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3896kb
  • [2024-05-04 10:38:59]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

inline int read()
{
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0' || ch>'9') {if(ch=='-') f=1;ch=getchar();}
	while(ch>='0' && ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return f?-x:x;
}

#define x first
#define y second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ull;
const int N=85;

int n;
int a[N],d[N][N];
int f[N];

bool check() {
	rep(i,1,n-1) {
		d[i][i]=a[i];
		rep(j,i+1,n-1) d[i][j]=min(d[i][j-1],a[j]);
	}
	rep(i,1,n) {
		int sum=0;
		rep(j,1,i-1) sum+=d[j][i-1];
		rep(j,i,n-1) sum+=d[i][j];
		// cout<<f[i]<<' '<<sum<<endl;
		if(sum!=f[i]) return false;
	}
	puts("Yes");
	rep(i,1,n-1) printf("%d ",a[i]);
	return true;
}

bool dfs(int u) {
	if(u>=n) return check();
	rep(i,0,19) {a[u]=i; if(dfs(u+1)) return true;}
	return false;
}

int main()
{
	n=read();
	rep(i,1,n) f[i]=read();
	// a[1]=1,a[2]=2;
	// cout<<check();
	if(!dfs(1)) puts("NO");
	
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

5
14 14 12 13 13

output:

Yes
5 3 3 4 

result:

ok The answer is correct.

Test #2:

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

input:

5
4 4 7 7 4

output:

Yes
1 1 4 1 

result:

ok The answer is correct.

Test #3:

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

input:

5
4 13 14 14 13

output:

Yes
1 4 5 4 

result:

ok The answer is correct.

Test #4:

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

input:

5
11 11 10 5 5

output:

Yes
5 4 1 2 

result:

ok The answer is correct.

Test #5:

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

input:

5
10 10 10 4 4

output:

Yes
4 4 1 1 

result:

ok The answer is correct.

Test #6:

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

input:

5
20 20 17 7 4

output:

Yes
10 7 2 1 

result:

ok The answer is correct.

Test #7:

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

input:

5
12 12 16 19 19

output:

Yes
3 3 5 8 

result:

ok The answer is correct.

Test #8:

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

input:

5
2 2 6 11 11

output:

Yes
2 0 3 8 

result:

ok The answer is correct.

Test #9:

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

input:

5
10 10 8 5 5

output:

Yes
5 3 1 2 

result:

ok The answer is correct.

Test #10:

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

input:

5
24 24 28 28 26

output:

Yes
6 6 9 7 

result:

ok The answer is correct.

Test #11:

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

input:

5
5 5 22 31 31

output:

Yes
2 1 10 19 

result:

ok The answer is correct.

Test #12:

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

input:

5
8 33 38 38 29

output:

Yes
2 11 16 9 

result:

ok The answer is correct.

Test #13:

score: 11
Accepted
time: 2ms
memory: 3648kb

input:

5
16 16 4 12 12

output:

Yes
13 1 1 9 

result:

ok The answer is correct.

Test #14:

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

input:

5
29 29 24 26 26

output:

Yes
11 6 6 8 

result:

ok The answer is correct.

Test #15:

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

input:

5
0 33 33 32 32

output:

Yes
0 13 10 12 

result:

ok The answer is correct.

Test #16:

score: 0
Wrong Answer
time: 2ms
memory: 3452kb

input:

5
20 16 8 25 22

output:

NO

result:

wrong answer Line 1 expected 

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%