2018-10-27から1日間の記事一覧

ある条件下の最大の index を二分探索で取得

実現したいこと ある条件下の最大の index を二分探索で取得 ある数以下 upperBound で実現できる。 public void solve(int testNumber, InputReader in, PrintWriter out) { int[] a = {18, 37, 75, 80, 80, 93, 107, 144, 163, 196}; int num = 40; int id…

COLOCON -Colopl programming contest 2018-D:すぬけそだて――トレーニング――

問題 https://beta.atcoder.jp/contests/colopl2018-qual/tasks/colopl2018_qual_d 考え方 dpを考えるのは自然である。 dp[i][k] := 個までの時刻のうち、 回起動しているときの知力の最大値 とする。ナイーブなDP遷移を考えると dp[i][k] = (0 <= j < i) ma…