Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- string solve()
- {
- int n, a;
- map<int, int> m;
- cin >> n;
- while(n--) {
- cin >> a;
- m[a]++;
- }
- if(m.count(0) >= 3) return "YES";
- for(auto [k, v]: m) {
- if(v >= 2 && m.count(-(k+k)) >= 1) return "YES";
- }
- for(auto [k1, v1]: m) {
- for(auto [k2, v2]: m) {
- if(k1 != k2 && m.count(-(k1+k2)) >= 1) return "YES";
- }
- }
- return "NO";
- }
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("in.txt", "r", stdin);
- #endif
- cout << solve() << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement