Please read the new rule regarding the restriction on the use of AI tools. ×

Kindly help me

Revision en1, by SHASTRI, 2021-01-30 09:14:24

https://codeforces.me/contest/1478/problem/C -problem link I am getting error as "uninitialized value usage" in this line — s.insert(a[i]); Can anyone help me to fix this issue Thanks in advance!!

include

include<bits/stdc++.h>

using namespace std;

int main() {

int t;cin>>t; while(t--) { int n;cin>>n; int m=2*n; int a[m]; set s; for(int i=0;i<m;i++) { cin>>a[i]; s.insert(a[i]); } if(s.size()!=n) { cout<<"NO"<<endl; continue; } vector v; for(auto i:s) v.push_back(i); long long sum=0,f=1; // cout<<v[0]<<v[1]<<endl;; for(int i=n-1;i>=0;i--) { v[i]-=sum; if(v[i]>0&&v[i]%(2*(i+1))==0) { v[i]/=2*(i+1); sum+=v[i]*2; } else {//cout<<i<<" "<<v[i]<<sum; f=0; break; } } if(f==1) cout<<"YES"<<endl; else cout<<"NO"<<endl;

} return 0; } Can anyone help me to fix this issue Thanks in advance!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English SHASTRI 2021-01-30 09:19:56 855
en1 English SHASTRI 2021-01-30 09:14:24 1105 Initial revision (published)