結果

問題 No.607 開通777年記念
ユーザー RyutoRyuto
提出日時 2017-12-11 13:46:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,006 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 48,472 KB
最終ジャッジ日時 2023-08-20 10:06:21
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,076 KB
testcase_01 AC 16 ms
7,904 KB
testcase_02 AC 16 ms
8,120 KB
testcase_03 AC 17 ms
8,084 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 16 ms
8,120 KB
testcase_06 AC 16 ms
8,092 KB
testcase_07 AC 70 ms
10,492 KB
testcase_08 AC 16 ms
7,884 KB
testcase_09 AC 26 ms
8,588 KB
testcase_10 AC 20 ms
8,496 KB
testcase_11 AC 932 ms
48,372 KB
testcase_12 AC 1,006 ms
48,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

nm = [int(x) for x in input().split()]
indats = []
for i in range(nm[1]):
    tmpl = [int(x) for x in input().split()]
    indats.append(tmpl)

npax = [0 for x in range(nm[0])]
for indat in indats:
    if sum([x**2 for x in indat]) == 0:
        continue
    npax = [x + y for (x, y) in zip(npax, indat)]
    for i in range(nm[0]):
        sumpax = 0
        for j in range(nm[0]-i):
            sumpax += npax[i+j]
            if sumpax == 777:
                print('YES')
                exit()
            elif sumpax > 777:
                break

print('NO')
0