結果

問題 No.607 開通777年記念
ユーザー takakin
提出日時 2020-05-24 21:45:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,054 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-12 08:20:29
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
T=[0]*n
ans=False
for _ in range(m):
  A=[int(i) for i in input().split()]
  for i in range(n):
    T[i]+=A[i]
  l,r=0,1
  tot=T[0]
  while True:
    if tot>777:
      tot-=T[l]
      l+=1
    elif tot<777:
      if r==n:
        break
      else:
        tot+=T[r]
        r+=1
    else:
      ans=True
      break
  else:
    continue
print("YES" if ans else "NO")
0