code:
#include#include #include #include using namespace std;int n,recnt,m[45000],cnt2=0,a[45000];vector reans;vector ans[45000];bool v[45000];bool judge(int x){ for(int i=0;i ans[b][i]) return 1; return 0;}int main(){ freopen("city.in","r",stdin); freopen("city.out","w",stdout); scanf("%d",&n); memset(m,0,sizeof(m)); for(int i=1;i<=n*(n-1)/2;i++) scanf("%d",&m[i]); sort(m+1,m+1+n*(n-1)/2); for(int i=3;i<=n*(n-1)/2;i++){ while(m[i]==m[i+1]){i++;} memset(v,false,sizeof(v)); v[1]=true;v[2]=true;v[i]=true; jie(i); bool qqq=false; for(int gg=0;gg reans[gg+1]){ reans.clear(); qqq=true; break; } if(qqq==true) continue; for(int p=3;p<=n;p++) if(v[p]==false) reans.push_back(m[p]-reans[0]); bool t=true; for(int j=1;j<=n*(n-1)/2;j++) if(judge(j)!=true){ t=false; break; } if(t==true) push(); else reans.clear(); } for(int i=1;i<=recnt;i++) if(ans[i].size()!=0) cnt2++; for(int i=1;i<=cnt2;i++) a[i]=i; for(int i=1;i
v[]=true
ans1+ans3=m[2]
v[]=true
ans2+ans3=m[i]v[]=true 解得 ans1,ans2,ans3; a1+a4=min(m[j]&&v[j]==false) a4.a5.a6..... check();