1 条题解
-
0
#include<bits/stdc++.h> using namespace std; #define int long long const int N=1e5+10; signed main() { int n;cin>>n; map<int,int>mp;priority_queue<int,vector<int>,greater<int>>q; for(int i=1;i<=n;i++) { int x,y;cin>>x>>y; if(!mp[x])q.push(x); mp[x]+=y; } int ans=0; while(!q.empty()) { int x=q.top();q.pop(); if(mp[x]&1)ans++;if(mp[x]==1)continue; if(!mp[x*2])q.push(x*2); mp[x*2]+=mp[x]/2; } cout<<ans; return 0; }
- 1
信息
- ID
- 8811
- 时间
- 3000ms
- 内存
- 1024MiB
- 难度
- 10
- 标签
- 递交数
- 2
- 已通过
- 2
- 上传者