Codeforces Manthan Codefest 19 D問題 - Restore Permutation

Source

Codeforces Manthan Codefest 19 D問題 (2000pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20190830-1)のコード

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

//no-unlocked
int N; ll S[2d5];
int res[2d5];
{
  int i, j, k;
  fenwick<ll> f;
  rd(N,S(N));

  f.walloc(N+1);
  f.init(N+1);
  rep(i,1,N+1) f.add(i, i);
  for(i=N-1;i>=0;i--){
    k = bsearch_max[int,x,1,N]( f.get(x-1) <= S[i] );
    res[i] = k;
    f.add(k, -k);
  }
  wt(res(N));
}

Current time: 2024年04月19日19時24分12秒
Last modified: 2019年08月30日20時25分55秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: