题意:
解法:
将式子变为ax^2+bx=-c,
map标记所有-c,然后O(n^2)枚举a和b,判断-c是否存在即可.
code:
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxm=2e6+5;
int a[maxm];
int n,x;
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
cin>>n>>x;
for(int i=1;i<=n;i++)cin>>a[i];
map<int,int>mark;
for(int i=1;i<=n;i++)mark[a[i]]=1;
int ok=0;
for(int i=1;i<=n&&!ok;i++){
for(int j=1;j<=n&&!ok;j++){
int p=a[i]*x*x+a[j]*x;
if(mark[-p]){
ok=1;
}
}
}
if(ok)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}