Codeforces Round #687 (based on Technocup 2021 Elimination Round 2) DIV1 C問題/DIV2 E問題/Round2 E問題 - New Game Plus!

Source

Codeforces Round #687 (based on Technocup 2021 Elimination Round 2) DIV1 C問題 (1500pt)
Codeforces Round #687 (based on Technocup 2021 Elimination Round 2) DIV2 E問題 (2500pt)
Technocup 2021 - Elimination Round 2 E問題 (2500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201205-1)のコード

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

//no-unlocked
int N, K; ll A[5d5], s[5d5];
{
  int i, k, fg = 0;
  ll res = 0, cur = 0;
  rd(N,K,A(N));
  rsortA(N,A);
  rep(i,N){
    res += cur;
    cur += A[i];
    if(cur < 0){
      N -= i;
      rep(k,N) A[k] = A[k+i];
      A[0] = cur;
      fg = 1;
      break;
    }
  }
  if(!fg) wt(res), return 0;
  
  K = min(K+1, N);
  rep(i,K) s[i] = 0;
  rep(i,N) res += s[i%K], s[i%K] += A[i];

  wt(res);
}

Current time: 2022年05月18日08時10分54秒
Last modified: 2020年12月05日15時42分41秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF687 CF_DIV1_C CF_DIV2_E
トップページに戻る

Logged in as: unknown user (not login)

ログイン: