結果

問題 No.607 開通777年記念
ユーザー ninja-kidninja-kid
提出日時 2022-05-28 19:24:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 77,232 KB
最終ジャッジ日時 2023-10-20 23:36:03
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,676 KB
testcase_01 AC 43 ms
55,676 KB
testcase_02 AC 45 ms
55,676 KB
testcase_03 AC 41 ms
55,676 KB
testcase_04 AC 43 ms
55,676 KB
testcase_05 AC 44 ms
55,676 KB
testcase_06 AC 43 ms
55,676 KB
testcase_07 AC 70 ms
75,620 KB
testcase_08 AC 44 ms
55,676 KB
testcase_09 AC 60 ms
66,280 KB
testcase_10 AC 42 ms
55,676 KB
testcase_11 AC 162 ms
77,232 KB
testcase_12 AC 165 ms
77,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from collections import Counter, deque
from itertools import accumulate


dpos4 = ((1, 0), (0, 1), (-1, 0), (0, -1))
def main():
  N, M = map(int, input().split())

  count = [0] * N
  for _ in range(M):
    A = list(map(int, input().split()))
    for i in range(N):
      count[i] += A[i]
    acc = [0] + list(accumulate(count))
    right = 0
    for left in range(N + 1):
      right = max(left, right)
      while right < N + 1 and acc[right] - acc[left] < 777:
        right += 1
      if right == N + 1: break
      if acc[right] - acc[left] == 777:
        print("YES")
        return
  print("NO")
if __name__ == '__main__':
  main()
0