結果

問題 No.607 開通777年記念
ユーザー GrayCoderGrayCoder
提出日時 2017-12-07 22:15:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,507 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 94,364 KB
最終ジャッジ日時 2023-08-19 12:28:46
合計ジャッジ時間 5,506 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,080 KB
testcase_01 AC 73 ms
71,184 KB
testcase_02 AC 73 ms
71,212 KB
testcase_03 AC 75 ms
71,112 KB
testcase_04 AC 73 ms
71,156 KB
testcase_05 AC 73 ms
71,388 KB
testcase_06 AC 73 ms
70,960 KB
testcase_07 AC 119 ms
78,704 KB
testcase_08 AC 81 ms
71,116 KB
testcase_09 AC 96 ms
75,968 KB
testcase_10 AC 94 ms
75,996 KB
testcase_11 AC 1,353 ms
94,364 KB
testcase_12 AC 1,507 ms
94,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M = map(int, input().split())
    A = [list(map(int, input().split())) for _ in [0] * M]

    a = [[0 for _ in [0] * (N + 1)] for _ in [0] * (M + 1)]
    for j in range(N):
        for i in range(M):
            a[i+1][j+1] = A[i][j] + a[i][j+1]
        for i in range(M):
            a[i+1][j+1] += a[i+1][j]

    for i in range(1, M + 1):
        if max(a[i]) < 777:
            continue
        elif 777 in a[i]:
            print('YES')
            break
        j = N
        while j > 0:
            x = a[i][j] - 777
            if x in a[i]:
                print('YES')
                return
            j -= 1
    else:
        print('NO')

main()
0