Yandex.Algorithm 2020 Qualification round
問題文
省略
省略
C++に変換後のコードはこちら
int N, K, R, A;
multiset<ll> a, b;
ll s, t, u;
int ress; ll res[2d5];
{
rd(N,K,R);
rep(K){
rd(A);
a.insert(A);
s += A;
}
rep(N-K) b.insert(rd_ll());
rep(R){
t = s;
s -= popFirst(a);
a.insert(t);
s += t;
if(b.size() && getLast(a) > getFirst(b)){
t = popLast(a);
u = popFirst(b);
a.insert(u);
b.insert(t);
s += u - t;
}
}
for(ll x : a) res[ress++] = x;
for(ll x : b) res[ress++] = x;
wt(res(ress));
}
Current time: 2024年04月27日06時06分51秒
Last modified: 2020年10月31日02時37分44秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Yandex_Algorithm
トップページに戻る
Logged in as: unknown user (not login)