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

2019年11月10日18時37分21秒

AtCoder Grand Contest 040 B問題 - Two Contests

Source

AtCoder Grand Contest 040
問題文

問題概要

省略

解法

省略

cLayversion 20191108-1)のコード

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

int N, L[1d5], R[1d5];
{
  int res = 0, mn, mx, all, k, x, y;
  rd(N,(L,R)(N));

  rep(i,N) R[i] *= -1;
  sortA(N,L,R);
  rep(i,N) R[i] *= -1;

  mn = max(L(N));
  mx = min(R(N));
  all = max(mx - mn + 1, 0);
  rep(i,N) res >?= R[i] - L[i] + 1 + all;

  k = 0;
  rep(i,N){
    while(k > 0 && R[i] <= R[k-1]) k--;
    arrInsert(k,k,L,L[i],R,R[i]);
  }
  N = k;

  rep(i,1,N){
    x = max(0, R[0] - L[i-1] + 1);
    y = max(0, R[i] - L[N-1] + 1);
    res >?= x + y;
  }

  wt(res);
}

Current time: 2024年04月19日12時07分52秒
Last modified: 2019年11月10日18時37分21秒 (by laycrs)
Tags: Competitive_Programming_Incomplete AtCoder AtCoder_Grand_Contest AGC040 AGC_B
トップページに戻る

Logged in as: unknown user (not login)

ログイン: