Codeforces Round #681 (based on VK Cup 2019-2020 - Final) DIV1 B問題/DIV2 F問題/Final A問題 - Identify the Operations

Source

Codeforces Round #681 (based on VK Cup 2019-2020 - Final) DIV1 B問題 (1000pt)
Codeforces Round #681 (based on VK Cup 2019-2020 - Final) DIV2 F問題 (3000pt)
VK Cup 2019-2020 - Final Round A問題 (500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201102-1)のコード

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

//no-unlocked
#define MD 998244353
int N, K, A[2d5], B[2d5];
int cnv[2d5];
int pr[2d5], nx[2d5], dm[2d5];
{
  REP(rd_int()){
    int x, y, p;
    Modint res = 1;
    rd(N,K,(A--)(N),(B--)(K));
    rep(i,N) cnv[A[i]] = i;
    rep(i,K) B[i] = cnv[B[i]];

    rep(i,N) pr[i] = i - 1;
    rep(i,N) nx[i] = i + 1;
    rep(i,N) dm[i] = 0;
    rep(i,K) dm[B[i]] = 1;

    rep[B](i,K){
      dm[i] = 0;
      x = pr[i];
      y = nx[i];
      p = 0;
      if(0 <= x < N && dm[x]==0) p++;
      if(0 <= y < N && dm[y]==0) p++;
      res *= p;
      if(0 <= x < N) nx[x] = y;
      if(0 <= y < N) pr[y] = x;
    }
    wt(res);
  }
}

Current time: 2024年04月19日16時34分05秒
Last modified: 2020年11月03日08時08分30秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF681 CF_DIV1_B CF_DIV2_F
トップページに戻る

Logged in as: unknown user (not login)

ログイン: