結果

問題 No.3715 Tomorrow is MONDAY!!!!!!
コンテスト
ユーザー Kude
提出日時 2026-09-18 21:48:22
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 109 ms / 2,000 ms
+ 333µs
コード長 364 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 79 ms
コンパイル使用メモリ 80,768 KB
実行使用メモリ 116,224 KB
最終ジャッジ日時 2026-09-18 21:48:33
合計ジャッジ時間 5,150 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

k, n = map(int, input().split())
d = list(map(int, input().split()))
before = 0
after = sum(d) - k
s = 0
for d in d:
    after -= d - 1
    cand = []
    pre = (s - 1) % n + 1
    if pre <= before: cand.append(pre)
    nxt = n - (s + d - 1) % n
    if nxt <= after: cand.append(nxt)
    ans = min(cand) if cand else -1
    before += d - 1
    s += d
    print(ans)
0