正的负的分两段,只要没有相加等于0就欧克
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
set<int>a,b;
int main(){
int n,x=0,y=0;
cin>>n;
for(int i=0;i<n;i++){
int t;cin>>t;
if(t==0){cout<<"NO"<<endl;return 0;}
if(t>0)a.insert(t);
else b.insert(t);
}
if(b.empty()){cout<<"YES"<<endl;return 0;}
else if(a.empty()){cout<<"YES"<<endl;return 0;}
for(auto i:a){
for(auto j:b){
if(i+j!=0){
cout<<"YES"<<endl;
return 0;
}
}
}
cout<<"NO"<<endl;
return 0;
}