結果

問題 No.607 開通777年記念
コンテスト
ユーザー marcypy
提出日時 2021-05-26 07:39:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 533 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 282 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 98,560 KB
最終ジャッジ日時 2026-05-02 23:32:46
合計ジャッジ時間 2,202 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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