[ABC323D] Merge Slimes 贪心
作者:
多米尼克領主的致意
,
2024-05-13 15:28:26
,
所有人可见
,
阅读 2
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;
int n;
map<ll, ll>h;
int xb[N];
// priority_queue<int, vector<int>, greater<int>>heap;
// set<ll>st;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1;i <= n;i++){
int x, y;
cin >> x >> y;
h[x] += y;
}
int ans = 0;
for(auto &[a, b] : h){
if(h[a] > 1){
h[2 * a] += b / 2;
h[a] %= 2;
}
ans += h[a];
}
cout << ans << endl;
return 0;
}