https://atcoder.jp/contests/abc443/tasks/abc443_c
逐次実行すると遅いと思っていましたが、意外と速いですね。実質100msかかっていないです。
v <- scan("stdin", numeric()) N <- as.integer(v[1]) T <- as.integer(v[2]) if(N == 0) { A <- c() } else { A <- v[3:(N+2)] } s <- 0 open_time <- 0 for(a in A) { if(a > open_time) { s <- s + a - open_time open_time <- a + 100 } } if(T > open_time) { s <- s + T - open_time } cat(format(s, scientific=FALSE), "\n")