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

2020年09月19日08時54分18秒

Codeforces Round #665 DIV2 E問題 - Divide Square

Source

Codeforces Round #665 DIV2 E問題 (2500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20200916-1)のコード

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

//no-unlocked
int N, M;
int Y[1d5], LX[1d5], RX[1d5], lxy[1d5], rxy[1d5];
int X[1d5], LY[1d5], RY[1d5];

{
  int cl = 0, cr = 0;
  ll res = 1;
  fenwick<int> t;
  rd(N,M,(Y,LX,RX)(N),(X,LY,RY)(M));
  t.malloc(1d6+1, 1);
  t.add(0,1);
  t.add(1d6,1);

  rep(i,N) if(RX[i]-LX[i]==1d6) res++;
  rep(i,N) lxy[i] = rxy[i] = Y[i];
  sortA(N, LX, lxy);
  sortA(N, RX, rxy);
  sortA(M, X, LY, RY);

  rep(i,M){
    while(cl < N && LX[cl] <= X[i]) t.add(lxy[cl++], 1);
    while(cr < N && RX[cr] < X[i]) t.add(rxy[cr++], -1);
    res += t.range(LY[i], RY[i]) - 1;
  }
  wt(res);
}

Current time: 2024年03月29日22時02分34秒
Last modified: 2020年09月19日08時54分18秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF665 CF_Div2_E
トップページに戻る

Logged in as: unknown user (not login)

ログイン: