|
|
back to boardCan anyone tell me whats wrong with this code #include <bits/stdc++.h> using namespace std; int main(){ int n1,n2; int a[n1],b[n2]; cin>>n1; for(int k=0;k<n1;k++) cin>>a[k]; cin>>n2; for(int k=0;k<n2;k++) cin>>b[k]; sort(a,a+n1); sort(b,b+n2); int i=0,j=n2-1; bool ans=false; while(i<n1&&j>=0){ if(a[i]+b[j]==10000){ ans=true; break; } else if(a[i]+b[j]>10000){ j--; } else{ i++; } } if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; } |
|
|