結果

問題 No.607 開通777年記念
ユーザー DrDrpilot
提出日時 2022-01-21 14:04:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,131 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 50,944 KB
最終ジャッジ日時 2024-11-25 09:03:47
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
for i in range(1,m):
    for j in range(n):
        a[i][j]+=a[i-1][j]
for i in range(m):
    q=deque()
    now=0
    for j in range(n):
        now+=a[i][j]
        q.append(a[i][j])
        while q and now>777:
            out=q.popleft()
            now-=out
        if now==777:
            print('YES')
            exit()
print('NO')
0