結果

問題 No.607 開通777年記念
コンテスト
ユーザー htkb
提出日時 2018-05-19 12:43:24
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 543 ms / 2,000 ms
+ 534µs
コード長 401 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2026-10-13 10:42:09
合計ジャッジ時間 2,980 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
N, M = map(int, input().split())
a = [0] * N
for l in sys.stdin.readlines():
    a = [n+m for n, m in zip(a, map(int, l.split()))]+[0]
    i, j, total = 0, 1, a[0]
    while j <= N:
        if total == 777:
            print("YES")
            exit()
        if total < 777:
            total += a[j]
            j += 1
        else:
            total -= a[i]
            i += 1
print("NO")
0