結果
| 問題 | No.607 開通777年記念 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-03-17 04:05:06 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,410 ms / 2,000 ms | 
| コード長 | 523 bytes | 
| コンパイル時間 | 122 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-11-29 03:57:24 | 
| 合計ジャッジ時間 | 3,986 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
from itertools import accumulate
from bisect import bisect_left
N, M = map(int, input().split())
yes = False
a = [0] * N
for i in range(M):
    b = [a[i] + int(x) for i, x in enumerate(input().split())]
    c = list(accumulate(b))
    l = r = 0
    while True:
        x = 777 + (0 if l == 0 else c[l-1])
        r = bisect_left(c, x, r)
        if r == N: break
        if c[r] == x:
            yes = True
            break
        l += 1
        r = max(l, r)
    if yes: break
    a = b
print('YES' if yes else 'NO')
            
            
            
        