保存されている過去のバージョンの一覧

2020年12月11日22時52分39秒

Codeforces Global Round 12 D問題 - Rating Compression

Source

Codeforces Global Round 12 D問題 (1750pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201206-1)のコード

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

//no-unlocked
int N, A[3d5];
vector<int> ind[3d5];
char res[3d5+2];

void solve(void){
  int x, y, z;

  rep(i,N) res[i] = '0';
  res[N] = '\0';

  rep(i,N) if(A[i] == 0) break;
  if(i==N) return;

  rep(i,N) ind[i].clear();
  rep(i,N) ind[A[i]].push_back(i);
  rep(i,N) if(ind[i].size() == 0) break;
  if(i==N) res[0]++;

  x = 0; y = N-1; z = 0;
  while(z < N-1){
    if(ind[z].size() == 0) break;
    res[N-z-1]++;
    if(ind[z].size() > 1) break;
    if(A[x] != z && A[y] != z) break;
    if(A[x]==z) x++;
    if(A[y]==z) y--;
    z++;
  }
}

{
  REP(rd_int()){
    rd(N,(A--)(N));
    solve();
    wt(res);
  }
}

Current time: 2024年04月20日21時56分18秒
Last modified: 2020年12月11日22時52分39秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces Codeforces_Global_Round_12
トップページに戻る

Logged in as: unknown user (not login)

ログイン: