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

2019年11月23日18時55分23秒

Educational Codeforces Round 76 D問題 - Yet Another Monster Killing Problem

Source

Educational Codeforces Round 76 D問題
Problem description

問題概要

省略

解法

省略

cLayversion 20191123-1)のコード

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

//no-unlocked
int N, A[2d5], M, P[2d5], S[2d5];
{
  int i, k, res;
  int mx, cnt;
  REP(rd_int()){
    rd(N,A(N),M,(P,S)(M));
    rsortA(M,P,S);

    k = 0;
    rep(i,M) if(k==0 || S[i] > S[k-1]) arrInsert(k,k,P,P[i],S,S[i]);
    M = k;

    rep(i,N) if(A[i] > P[0]) wt(-1), break_continue;

    res = k = 0;
    while(k < N){
      res++;
      mx = A[k++];
      cnt = 1;
      i = 0;
      while(k < N){
        if(max(A[k],mx) <= P[i] && cnt < S[i]){
          mx >?= A[k];
          k++;
          cnt++;
          continue;
        }
        if(i+1==M || max(A[k],mx) > P[i+1]) break;
        i++;
      }
    }
    wt(res);
  }
}

Current time: 2024年04月17日04時51分28秒
Last modified: 2019年11月23日18時55分23秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: