結果

問題 No.607 開通777年記念
ユーザー FromBooskaFromBooska
提出日時 2023-03-18 16:50:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 77,560 KB
最終ジャッジ日時 2023-10-18 17:24:34
合計ジャッジ時間 2,473 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,492 KB
testcase_01 AC 37 ms
53,492 KB
testcase_02 AC 37 ms
53,492 KB
testcase_03 AC 36 ms
53,492 KB
testcase_04 AC 36 ms
53,492 KB
testcase_05 AC 37 ms
53,492 KB
testcase_06 AC 37 ms
53,492 KB
testcase_07 AC 97 ms
76,156 KB
testcase_08 AC 37 ms
53,520 KB
testcase_09 AC 50 ms
64,240 KB
testcase_10 AC 50 ms
64,240 KB
testcase_11 AC 234 ms
77,560 KB
testcase_12 AC 223 ms
77,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
ans = 'NO'
A = [0]*N
for i in range(M):
    add = list(map(int, input().split()))
    for i in range(N):
        A[i] += add[i]
    cumu = [0]
    temp = 0
    for i in range(N):
        temp += A[i]
        cumu.append(temp)
    target = set()
    for i in range(N+1):
        if cumu[i] in target:
            ans = 'YES'
            break
        else:
            target.add(cumu[i]+777)
    #print(A, cumu, target, ans)
print(ans)
0