Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <vector>
- //#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main() {
- ios_base::sync_with_stdio(false);
- int n;
- cin >> n;
- vector<ll> cnt(1005, 0);
- ll sum = 0;
- for(int i = 0; i < n; i++) {
- int a, b;
- cin >> a >> b;
- sum += b;
- cnt[a] += b;
- ll tmp_sum = 0;
- for(int j = 0; j <= 1000; j++) {
- tmp_sum += cnt[j];
- if(tmp_sum >= (sum + 1) / 2) {
- cout << j << "\n";
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement