Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6.  
  7. const ll maxn = 200000;
  8. const ll maxa = 1000005;
  9.  
  10. ll n, A[maxa], R[maxa], C[maxa], s, res, dva = 2LL;
  11.  
  12. int main()
  13. {
  14.     cin >> n;
  15.     for (ll i = 0; i < n; ++i)
  16.         cin >> A[i], s += A[i], C[A[i]]++;
  17.  
  18.     for (ll i = 0; i < n; ++i)
  19.     {
  20.         if (!((s - A[i]) & 1LL))
  21.         {
  22.             C[A[i]]--;
  23.             if (C[(s - A[i]) >> 1LL])
  24.                 R[res++] = i + 1LL;
  25.            
  26.             C[A[i]]++;
  27.         }
  28.     }
  29.  
  30.     cout << res << '\n';
  31.     for (ll i = 0; i < res; ++i)
  32.         cout << R[i] << ' ';
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement