Codeforces Round #562 DIV1 A問題 (500pt)
Codeforces Round #562 DIV2 C問題 (1500pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N, M;
int A[3d5];
{
int i, j, k, s, ok;
int x, y, z;
rd(N,M,A(N));
x = 0;
y = M;
while(x < y){
z = (x+y) / 2;
k = 0;
rep(i,N){
s = M + 1;
if(A[i] >= k)
s = A[i];
} else if(A[i]+z >= k){
s = k;
}
if(A[i]+z >= M+k){
s = k;
}
if(s==M+1) break;
k = s;
}
if(i==N) y = z; else x = z + 1;
}
wt(x);
}
Current time: 2024年05月11日12時38分31秒
Last modified: 2019年05月27日21時59分37秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF562 CF_Div1_A CF_Div2_C
トップページに戻る
Logged in as: unknown user (not login)