Codeforces Round #686 DIV3 F問題 - Array Partition

Source

Codeforces Round #686 DIV3 F問題
Problem description

問題概要

省略

解法

省略

cLayversion 20201205-1)のコード

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

//no-unlocked
int N, A[2d5];
{
  segtree_Point_Minval<int> t;
  t.walloc(2d5);
  REP(rd_int()){
    int x, z, a, b, c;
    rd(N,A(N));
    t.setN(N);
    rep(i,N) t[i] = A[i];
    t.build();
    x = 1; a = A[0];
    z = 1; c = A[N-1];
    while(x+z < N){
      if(a < c) a >?= A[x++], continue;
      if(a > c) c >?= A[N-(++z)], continue;

      b = t.getMinVal(x, N-z);
      if(b==a) wt("YES"), wt(x, N-x-z, z), break_continue;

      if(A[x] < A[N-1-z] || (x+1 < N && N-2-z >= 0 && A[x] == A[N-1-z] && A[x+1] < A[N-2-z])){
        a >?= A[x++];
      } else {
        c >?= A[N-(++z)];
      }
    }
    wt("NO");
  }
}

Current time: 2024年04月20日12時58分52秒
Last modified: 2020年12月05日16時08分33秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF686 CF_DIV3_F
トップページに戻る

Logged in as: unknown user (not login)

ログイン: