夺笋啊
  • 板块灌水区
  • 楼主Genshineer
  • 当前回复1
  • 已保存回复1
  • 发布时间2021/8/10 19:26
  • 上次更新2023/11/4 11:09:41
查看原帖
夺笋啊
191248
Genshineer楼主2021/8/10 19:26

code

#include <bits/stdc++.h>
#define ull unsigned long long
#define LuoguNB cout << ans
#define luoguNB int read( ) {int tot = 0;char c = getchar();while(c < '0' || c > '9') {c = getchar();}while(c <= '9' && c >= '0') {tot = tot * 10 + c - '0';c = getchar();}return tot;}
#define luogunb ull get( ) {if (q2.empty( ) || ( !q1.empty( ) && q1.front( ) < q2.front( ))) {ull x = q1.front( );q1.pop( );return x;}else {ull x = q2.front( );q2.pop( );return x;}}
#define Luogunb using namespace std;
#define LuoGuNB ull ans;int n;int a[10000005],b[100005];queue<ull> q1,q2;
#define LuoGunb int main(){
#define LUOGUNB	n = read( );ans = 0ll;
#define LuoguNb	for(int i = 1; i <= n; i++) {b[a[i] = read( )]++;}
#define LuogunB	for(int i = 1; i <= 100000; i++) {for(int j = 1; j <= b[i]; j++) {q1.push(i);}}
#define luOgUnb	for(int i=1;i<n;i++){ull x = get();ull y = get();ans += x + y;q2.push(x + y);}
#define LuOGUnb return 0;}
















Luogunb;
LuoGuNB;
luogunb;
luoguNB;
LuoGunb;
LUOGUNB;
LuoguNb;
LuogunB;
luOgUnb;
LuoguNB;
LuOGUnb;
2021/8/10 19:26
加载中...