Educational Codeforces Round 73 E問題 - Game With String

Source

Educational Codeforces Round 73 E問題
Problem description

問題概要

省略

解法

省略

cLayversion 20190921-1)のコード

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

//no-unlocked
int N, A, B;
char S[300003];

int sz, len[3d5], mx, cnt;
int fg[3];
{
  int i, j, k;
  REP(rd_int()){
    rd(A,B,S@N);
    S[N++] = 'X';

    mx = 0;
    sz = 0;
    k = -1;
    rep(i,N) if(S[i]=='X'){
      mx >?= i-k-1;
      len[sz++] = i-k-1;
      k = i;
    }

    fg[0] = fg[1] = fg[2] = 0;
    rep(i,mx-A+1){
      j = mx - i - A;
      if(B <= i < A || i >= 2B) continue;
      if(B <= j < A || j >= 2B) continue;
      fg[ if[i>=A,1,0] + if[j>=A,1,0] ] = 1;
    }

    cnt = 0;
    rep(i,sz){
      if(len[i] == mx) mx = -1, continue;
      if(B <= len[i] < A || len[i] >= 2B) cnt = -1, break;
      if(len[i] >= A) cnt++;
    }

    if(cnt==-1) wt("NO"), continue;
    rep(i,3) if(fg[i] && (cnt+i)%2 == 0) break;
    wt( if[i==3, "NO", "YES"] );
  }
}

Current time: 2021年12月05日23時16分58秒
Last modified: 2019年09月21日12時34分20秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: