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

2020年09月13日14時09分05秒

Codeforces Round #670 DIV2 D問題 - Three Sequences

Source

Codeforces Round #670 DIV2 D問題 (2000pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20200913-1)のコード

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

//no-unlocked
int N, Q, L, R, X;
ll A[1d5];
ll sa[1d5], ms, e;

void ad(int i, int x){
  if(sa[i] < 0) ms += sa[i];
  sa[i] += x;
  if(sa[i] < 0) ms -= sa[i];
}

{
  rd(N,A(N),Q);
  rep(i,N-1){
    sa[i] = A[i+1] - A[i];
    if(sa[i] < 0) ms -= sa[i];
  }
  e = A[N-1];
  wt(cDiv(e+ms, 2));
  rep(Q){
    rd(L--, R, X);
    if(L) ad(L-1, X);
    if(R==N){
      e += X;
    } else {
      ad(R-1, -X);
    }
    wt(cDiv(e+ms, 2));
  }
}

Current time: 2024年05月02日07時05分32秒
Last modified: 2020年09月13日14時09分05秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF670 CF_Div2_D
トップページに戻る

Logged in as: unknown user (not login)

ログイン: