UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214429#2386. 回忆zhangxinyang11100ms1304kbC++11907b2024-11-18 21:02:452024-11-19 08:34:27

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,s[10005],a[10005];
set<int> S,S2;
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n*(n-1)/2;i++)
	{
		cin>>s[i];
		S2.insert(s[i]);
	}
	sort(s+1,s+1+n*(n-1)/2);
	for(int i=1;i<=s[1];i++)
	{
		int top=2;
		S.clear();
		a[1]=i;
		a[2]=s[1]-i;
		if(a[1]>a[2])break;
		S.insert(a[1]+a[2]);
		for(int j=3;j<=n;j++)
		{
			while(S.find(s[top])!=S.end())top++;
			a[j]=s[top]-a[1];
			for(int k=1;k<j;k++)S.insert(a[j]+a[k]);
		}
		int pd=1;
		for(int i=1;i<=n*(n-1)/2;i++)
			if(S.find(s[i])==S.end())
			{
				pd=0;
				break;
			}
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				if(S2.find(a[i]+a[j])==S.end())
				{
					pd=0;
					break;
				}
		if(pd)
		{
			for(int i=1;i<=n;i++)cout<<a[i]<<" ";
			return 0;
		}
	}
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1216kb

input:

5
4 5 9 9 10 13 14 14 15 19

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

5
5 9 9 10 12 12 13 16 17 17

output:

1 4 8 9 15 

result:

wrong answer Your answer is incorrect.

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1220kb

input:

5
10 11 12 13 13 14 15 15 16 17

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

50
9 13 15 20 20 20 21 22 22 26 26 26 27 27 27 28 29 31 31 32 32 33 33 33 33 33 34 34 34 35 35 36 37...

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1304kb

input:

50
9 11 14 14 16 16 16 18 19 19 21 21 21 21 22 22 23 23 23 23 24 25 25 26 26 26 26 26 26 26 27 27 27...

output:

2 7 9 12 16 20 22 24 28 37 39 41 43 45 54 56 58 60 62 73 75 77 79 81 90 92 94 96 98 109 111 113 115 ...

result:

wrong answer Your answer is incorrect.

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1264kb

input:

50
7 9 12 16 19 21 26 27 29 29 31 33 33 33 34 35 36 36 36 36 37 38 38 38 38 39 39 40 40 40 41 41 42 ...

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #7:

score: 0
Runtime Error

input:

300
660422 717145 1052261 1191442 1526558 1583281 1636913 1972029 2028752 2207583 2247577 2427928 25...

output:


result:


Test #8:

score: 0
Runtime Error

input:

300
1719032 1728175 1968715 2265775 2506315 2515458 2534303 2752316 3002166 3035709 3071903 3081046 ...

output:


result:


Test #9:

score: 0
Runtime Error

input:

300
725653 809390 819383 974701 984694 1058923 1068431 1068916 1152653 1317964 1422171 1432164 15159...

output:


result:


Test #10:

score: 0
Runtime Error

input:

300
2355315 3132486 3240117 3325566 3662015 3854305 3961936 4047385 4053636 4142315 4383834 4725290 ...

output:


result: