結果

問題 No.607 開通777年記念
ユーザー htkbhtkb
提出日時 2018-05-19 12:43:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 790 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 12,980 KB
最終ジャッジ日時 2023-09-10 23:41:14
合計ジャッジ時間 3,508 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,100 KB
testcase_01 AC 15 ms
7,768 KB
testcase_02 AC 16 ms
8,040 KB
testcase_03 AC 16 ms
8,252 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 15 ms
8,184 KB
testcase_06 AC 15 ms
8,176 KB
testcase_07 AC 51 ms
8,720 KB
testcase_08 AC 15 ms
7,928 KB
testcase_09 AC 24 ms
7,760 KB
testcase_10 AC 16 ms
8,260 KB
testcase_11 AC 739 ms
12,980 KB
testcase_12 AC 790 ms
12,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N, M = map(int, input().split())
a = [0] * N
for l in sys.stdin.readlines():
    a = [n+m for n, m in zip(a, map(int, l.split()))]+[0]
    i, j, total = 0, 1, a[0]
    while j <= N:
        if total == 777:
            print("YES")
            exit()
        if total < 777:
            total += a[j]
            j += 1
        else:
            total -= a[i]
            i += 1
print("NO")
0