Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- int a[6000];
- bool used[2000000];
- vector <int> q;
- main()
- {
- set<int> s;
- int n, kol = 0, kol2 = 1e6;
- cin >> n;
- for(int i =0 ; i < n; i++){
- cin >> a[i];
- if(a[i] < 0){
- if(used[abs(a[i]) + kol2]) kol++;
- }
- else{
- if(used[a[i]]) kol ++;
- }
- if(s.find(a[i]) == s.end()){
- q.push_back(a[i]);
- for(int j = 0; j < q.size(); j++){
- for(int o = 0; o < q.size(); o++){
- int h = a[i] + q[j] + q[o];
- if(h >= 0 )used[h] = 1;
- else used[abs(h)+ kol2] =1;
- }
- }
- s.insert(a[i]);
- }
- }
- cout << kol;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement