Codeforces Round #692 (based on Technocup 2021 Elimination Round 3) DIV1 C問題/DIV2 E問題/Round3 E問題 - Poman Numbers

Source

Codeforces Round #692 (based on Technocup 2021 Elimination Round 3) DIV1 C問題 (1250pt)
Codeforces Round #692 (based on Technocup 2021 Elimination Round 3) DIV2 E問題 (2250pt)
Technocup 2021 - Elimination Round 3 E問題 (2250pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201229-1)のコード

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

//no-unlocked
int N; ll T; char S[1d5+2];
int cnt[26];
{
  ll k, x;
  rd(N,T,S);
  rep(i,N) S[i] -= 'a';

  if(N) T -= (1 << S[--N]);
  if(N) T += (1 << S[--N]);

  rep(i,N) cnt[S[i]]++;
  rrep(i,26){
    T = abs(T);
    x = (1 << i);
    k = min(T / x, cnt[i]);
    T -= x * k;
    cnt[i] = (cnt[i] - k) % 2;
    if(cnt[i]) T -= x;
  }

  wt(if[T==0, "Yes", "No"]);
}

Current time: 2024年04月21日00時27分10秒
Last modified: 2020年12月30日09時48分56秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF692 CF_DIV1_C CF_DIV2_E
トップページに戻る

Logged in as: unknown user (not login)

ログイン: