Saleh127

codeforces 1132B.cpp

May 29th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define pi acos(-1)
  5. int main()
  6. {
  7. long long a[350000],c,d,e,s=0,f,i,j,k,l;
  8. cin>>c;
  9. for(i=0;i<c;i++)
  10. {
  11. cin>>a[i];
  12. s+=a[i];
  13. }
  14. sort(a,a+c,greater<int>());
  15. cin>>d;
  16. while(d--)
  17. {
  18. cin>>e;
  19. f= s-a[e-1];
  20. cout<<f<<endl;
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment