Codeforces Round #610 DIV2 C問題 (1750pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N, T, A, B, TYPE[2d5];
int es, e[200001];
int hs, h[200001];
{
int a, b, k, res, tmp;
ll tm;
REP(rd_int()){
rd(N,T,A,B,TYPE(N));
es = hs = 0;
rep(i,N) if[TYPE[i]==0, e[es++], h[hs++]] = rd_int();
sortF(es, e);
sortF(hs, h);
e[es] = h[hs] = T+1;
a = b = res = 0;
for(;;){
tm = min(e[a], h[b]) - 1;
tm -= (ll) A * a + (ll) B * b;
if(tm >= 0){
tmp = a + b;
k = min(tm / A, es - a);
tmp += k; tm -= (ll) A * k;
k = min(tm / B, hs - b);
res >?= tmp + k;
}
if(a==es && b==hs) break;
if[e[a] < h[b], a++, b++];
}
wt(res);
}
}
Current time: 2024年04月26日10時21分48秒
Last modified: 2019年12月27日20時47分20秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF610 CF_Div2_C
トップページに戻る
Logged in as: unknown user (not login)