結果
問題 | No.607 開通777年記念 |
ユーザー |
|
提出日時 | 2022-05-28 19:24:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 135 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 77,928 KB |
最終ジャッジ日時 | 2024-09-20 23:37:33 |
合計ジャッジ時間 | 2,227 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#!/usr/bin/env python3from collections import Counter, dequefrom itertools import accumulatedpos4 = ((1, 0), (0, 1), (-1, 0), (0, -1))def main():N, M = map(int, input().split())count = [0] * Nfor _ in range(M):A = list(map(int, input().split()))for i in range(N):count[i] += A[i]acc = [0] + list(accumulate(count))right = 0for left in range(N + 1):right = max(left, right)while right < N + 1 and acc[right] - acc[left] < 777:right += 1if right == N + 1: breakif acc[right] - acc[left] == 777:print("YES")returnprint("NO")if __name__ == '__main__':main()