-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1077C.cpp
More file actions
54 lines (52 loc) · 1.12 KB
/
Copy path1077C.cpp
File metadata and controls
54 lines (52 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Author : Chinmay Jha
@chinmayajha on Codeforces, Codechef, USACO, AtCoder and CSES.fi
Date: 2021-06-24 21:51:53
*/
#include "bits/stdc++.h"
using lli = long long int;
using namespace std;
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define inarr(a,n) for(int i = 0; i < n; ++i) cin >> a[i];
#ifndef ONLINE_JUDGE
#define db(x) cerr << #x <<" = " << n << "\n";
#else
#define db(...)
#endif
//
template< class T >
void printa(T begin, T end){
T it = begin;
while(it < end)
cout << *it++ << " ";
cout << "\n";
}
void solve(){
int n;
cin >> n;
vector<lli> a(n);
vector<int> arr(int(1e6+1));
for(int i=0;i<n;++i){
cin >> a[i];
arr[a[i]]++;
}
lli sum = accumulate(all(a),0ll);
vector<lli> res;
for(int i=0;i<n;++i){
sum -= a[i];
arr[a[i]]--;
if(sum%2 == 0 && sum/2 <= int(1e6+1) && arr[sum/2] > 0)res.push_back(i);
sum += a[i];
arr[a[i]]++;
}
cout << res.size() << "\n";
for(auto i : res) cout << i+1 << " ";
}
int main(){
int t = 1;
// cin >> t;
while(t--){
solve();
}
}