UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#214426#2386. 回忆wangyaxu123Compile Error//C++111021b2024-11-18 21:01:502024-11-19 08:34:07

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e6+10,mod=1e9+7,inf=1e18+7;
inline int read(){
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
int n,sum[N],a[N];
multiset<int> s;
multiset<int>::iterator it;
bool check(int x){
	a[1]=x;
	for(int i=2;i<=n;i++){
		a[i]=*s.begin()-a[1];
		for(int j=1;j<i;j++){
			it=s.find(a[i]+a[j]);
			if(it==s.end())
			return 0;
			s.erase(it);
		}
	}
	return 1;
}
signed main(){
	n=read();
	//while(~scanf("%lld",&n)){
		for(int i=1;i<=(n-1)*n/2;i++)
		sum[i]=read();
		bool f=0;
		sort(sum+1,sum+1+(n-1)*n/2);
		for(int i=0;i<=sum[1]/2;i++){
			s.clear();
			for(int j=1;j<=n*(n-1)/2;j++)
			s.insert(sum[j]);
			if(check(i)){
				for(int j=1;j<=n;j++)
				cout<<a[j]<<" ";
				cout<<'\n';
				f=1;
				break;
			}
		}
		if(f)
		continue;
		else
		cout<<"Impossible"<<'\n';
//	}
	return 0;
}

Details

answer.code: In function 'int main()':
answer.code:47:3: error: continue statement not within a loop
   continue;\x0d
   ^