Grakn Forces 2020 C問題 - Discrete Acceleration

Source

Grakn Forces 2020 C問題 (1250pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201003-1)のコード

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

//no-unlocked
int N, L, A[1d5];
{
  REP(rd_int()){
    int i, j;
    double sx, sy, x, y, res = 0, tm;
    rd(N,L,A(N));

    i = 0; j = N-1;
    x = 0; y = L;
    sx = 1; sy = 1;

    while(i <= j){
      if( (A[i] - x) / sx <= (y - A[j]) / sy ){
        res += tm = (A[i] - x) / sx;
        x += tm * sx;
        y -= tm * sy;
        i++;
        sx++;
      } else {
        res += tm = (y - A[j]) / sy;
        x += tm * sx;
        y -= tm * sy;
        j--;
        sy++;
      }
    }
    res += (y - x) / (sx + sy);
    wt(res);
  }
}

Current time: 2024年04月20日03時41分19秒
Last modified: 2020年10月03日18時45分04秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces
トップページに戻る

Logged in as: unknown user (not login)

ログイン: