Codeforces Manthan Codefest 19 E問題 - Let Them Slide

Source

Codeforces Manthan Codefest 19 E問題 (2250pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20190830-1)のコード

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

//no-unlocked
int N, W, L, A[1d6];

int tmp[2d6], mx[2d6];
ll res[1d6];
ll s[1000001];
{
  int i, j, k, m;
  ll x;
  rd(N,W);
  rep(N){
    rd(L,A(L));
    if(2*L <= W){
      m = 0;
      rep(i,L){
        m >?= A[i];
        res[i] += m;
      }
      m = 0;
      rep(i,L){
        m >?= A[L-1-i];
        res[W-1-i] += m;
      }
      s[L] += m;
      s[W-L] -= m;
    } else {
      k = W - L;
      rep(i,k) tmp[i] = 0;
      rep(i,L) tmp[k+i] = A[i];
      rep(i,k) tmp[k+L+i] = 0;
      slideMax(L+2k, k+1, tmp, mx);
      rep(i,W) res[i] += mx[i];
    }
  }
  x = 0;
  rep(i,W) res[i] += (x += s[i]);
  wt(res(W));
}

Current time: 2024年04月20日01時05分13秒
Last modified: 2019年08月30日20時26分14秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: