Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define pb(x) push_back(x)
  3. #define pii pair <int,int>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int t; cin >> t;
  9.  
  10. int T[t];
  11.  
  12. for(int i=0;i<t;i++)cin >> T[i];
  13.  
  14. int m; cin >> m;
  15.  
  16. vector < pii > v;
  17.  
  18. while(m--){
  19. int a,b; cin >> a >> b;
  20. v.pb(make_pair(a,b));
  21. }
  22.  
  23. for(pii x : v){
  24. int i = x.first, j = x.second;
  25.  
  26. int time = 0;
  27.  
  28. for(int q=0;q<t;q++){
  29. if(q == i)time += j;
  30. else time += T[q];
  31. }
  32.  
  33. cout << time << endl;
  34. }
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement