QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#404632#8225. 最小值之和dingdingtang11514#0 6ms3900kbC++141.7kb2024-05-04 10:55:482024-05-04 10:55:50

Judging History

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

  • [2024-05-04 10:55:50]
  • 评测
  • 测评结果:0
  • 用时:6ms
  • 内存:3900kb
  • [2024-05-04 10:55:48]
  • 提交

answer

#include <iostream>
#include <cstring> 
#include <map>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
// #include <bits/stdc++.h>

// #define int long long
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rof(i,a,b) for(int i=(a);i>=(b);i--)
#define Grf(it,u,to) for(int it=he[u],to;(to=e[it],it);it=nxt[it]) 
#define In __inline 
#define OP operator
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
namespace Mine {
	// mt19937_64 wql(514);
	In int read() {
		ll x=1,a=0;
		char ch=getchar();
		while(ch>'9' || ch<'0') x=(ch=='-')?-1:x,ch=getchar();
		while(ch>='0' && ch<='9') a=(a<<1)+(a<<3)+(ch-'0'),ch=getchar();
		return a*x;
	} const int N=90;
	int f[N],n,ans[N],d[N][N],g[N];
	bool check() {
		bool ret=1;
		For(i,1,n-1) d[i][i]=ans[i];//,printf("%d ",ans[i]);
		// puts("");
		For(x,1,n-1) For(y,x+1,n) d[x][y]=min(d[x][y-1],ans[y]);
		// For(i,1,n-1) {For(j,1,n-1) printf("%d ",d[i][j]); puts("");}
		// puts("");
		For(i,1,n) { g[i]=0;
			For(j,1,i-1) g[i]+=d[j][i-1];
			For(j,i,n-1) g[i]+=d[i][j];
		} For(i,1,n) ret&=(g[i]==f[i]);//,printf("%d ",g[i]);;
		// puts("");puts("");
		return ret;
	} 
	namespace S0 {
		bool dfs(int dep) {
			if(dep>=n) {
				return check();
			} For(i,0,20) {
				ans[dep]=i;
				if(dfs(dep+1)) return 1;
			} return 0;
		}
		void solve0() {
			dfs(1); puts("Yes");
			For(i,1,n-1) printf("%d ",ans[i]);
		}
	}
	signed main() {
		n=read(); For(i,1,n) f[i]=read();
		if(n<=5) S0::solve0();
		return 0;
	}
}signed main() {
	// freopen("homework.in","r",stdin);
	// freopen("homework.out","w",stdout);
	return Mine::main();
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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: 1ms
memory: 3680kb

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: 3684kb

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: 2ms
memory: 3900kb

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: 3892kb

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: 3ms
memory: 3832kb

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: 1ms
memory: 3708kb

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: 3728kb

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: 2ms
memory: 3740kb

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: 2ms
memory: 3732kb

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: 3768kb

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: 3708kb

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: 3ms
memory: 3728kb

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: 3ms
memory: 3828kb

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: 1ms
memory: 3892kb

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: 6ms
memory: 3772kb

input:

5
20 16 8 25 22

output:

Yes
20 20 20 20 

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%