提出 #53337932


ソースコード 拡げる

#!/usr/bin/env python3
from collections import deque


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    ans = 0
    aki = K
    de = deque()

    for i in range(N):
        de.append(A[i])


    while len(de) > 0:
        if de[0] <= aki:
            aki -= de[0]
            de.popleft()
        
        else:
            aki = K
            ans += 1
    
    print(ans + 1)



if __name__ == '__main__':
    main()

提出情報

提出日時
問題 B - AtCoder Amusement Park
ユーザ rutent
言語 Python (PyPy 3.10-v7.3.12)
得点 200
コード長 492 Byte
結果 AC
実行時間 68 ms
メモリ 77012 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 15
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 68 ms 76840 KiB
00_sample_01.txt AC 67 ms 76808 KiB
00_sample_02.txt AC 67 ms 76732 KiB
01_random_03.txt AC 67 ms 76792 KiB
01_random_04.txt AC 67 ms 76744 KiB
01_random_05.txt AC 67 ms 76804 KiB
01_random_06.txt AC 67 ms 76648 KiB
01_random_07.txt AC 67 ms 76908 KiB
01_random_08.txt AC 67 ms 76720 KiB
01_random_09.txt AC 68 ms 76836 KiB
01_random_10.txt AC 68 ms 76660 KiB
01_random_11.txt AC 67 ms 77012 KiB
01_random_12.txt AC 67 ms 76812 KiB
01_random_13.txt AC 67 ms 76660 KiB
01_random_14.txt AC 67 ms 76908 KiB