Codeforces Round #591 DIV1 A問題/DIV2 C問題 - Save the Nature

Source

Codeforces Round #591 DIV1 A問題 (500pt)
Codeforces Round #591 DIV2 C問題 (1500pt)
Technocup 2020 - Elimination Round 1 C問題 (1500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20191012-1)のコード

C++に変換後のコードはこちら

//no-unlocked
int N, P[2d5], X, A, Y, B;
ll K;
{
  ll c, gain;
  int i, j, aa, bb, cc, res;
  REP(rd_int()){
    rd(N,P(N),X,A,Y,B,K);
    rep(i,N) P[i] /= 100;
    if(X < Y) swap(X,Y), swap(A,B);
    c = (ll) A * B / gcd(A,B);
    rsortA(N,P);
    res = bsearch_min[int,z,0,N+1][
      gain = 0;
      cc = z / c;
      aa = z / A - cc;
      bb = z / B - cc;
      j = 0;
      rep(cc) gain += P[j++] * (X+Y);
      rep(aa) gain += P[j++] * X;
      rep(bb) gain += P[j++] * Y;
    ](gain >= K);
    wt(if[res==N+1, -1, res]);
  }
}

Current time: 2024年04月20日08時09分02秒
Last modified: 2019年10月12日04時11分31秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF591 CF_Div1_A CF_Div2_C
トップページに戻る

Logged in as: unknown user (not login)

ログイン: