Advertisement
Saleh127

Cf 1077C

Aug 3rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. long long a[200005]= {0},c[200005]= {0};
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(0);
  7. cin.tie(0);
  8. cout.tie(0);
  9.  
  10. long long d,e=0,f,i,j,k,l;
  11. cin>>d;
  12. for(i=1; i<=d; i++)
  13. {
  14. cin>>a[i];
  15. c[i]=a[i];
  16. e+=a[i];
  17. }
  18. sort(c+1,c+d+1);
  19. vector<long long>nn;
  20. for(i=1; i<=d; i++)
  21. {
  22. if(a[i]!=c[d])
  23. {
  24. if(e-a[i]-c[d]==c[d])
  25. {
  26. nn.push_back(i);
  27. }
  28. }
  29. else if(e-a[i]-c[d-1]==c[d-1])
  30. {
  31. nn.push_back(i);
  32. }
  33. }
  34. cout<<nn.size()<<endl;
  35.  
  36. for(auto x:nn)
  37. {
  38. cout<<x<<" ";
  39. }
  40. cout<<endl;
  41. return 0;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement