結果

問題 No.607 開通777年記念
ユーザー marcypy
提出日時 2021-05-26 07:39:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,068 KB
実行使用メモリ 93,744 KB
最終ジャッジ日時 2024-10-15 04:43:30
合計ジャッジ時間 2,346 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys

f=lambda:map(int,input().split())
n,m=f()
A=[list(f()) for _ in range(m)]

#2次元累積和
R=[[0]*n for _ in range(m+1)]
for i in range(m):
    for j in range(n):
        R[i+1][j]=R[i][j]+A[i][j]

for r in R[1:]:
    #尺取り
    t=0
    q=deque()
    for c in r:
        q.append(c)
        t+=c
        #print(t)
        while q and t>777:
            rm=q.popleft()
            t-=rm
        
        if t==777:
            print('YES')
            sys.exit()
        
print('NO')   
0