提出 #53339280


ソースコード 拡げる

// Source: https://usaco.guide/general/io
 
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <unordered_map>
#include <utility>
#include <vector>
#define ll long long
const ll MAXN = 10000000;
void solve(){
    int n, k;
    std::cin >> n >> k;
    int t = k;
    int ans = 1;
    for(int i = 0; i < n; i++){
        int x;
        std::cin >> x;
        if(x > t){
            ans ++;
            t = k;
        }
        t -= x;
    }
    std::cout << ans;
}
int main(){
    solve();
}

提出情報

提出日時
問題 B - AtCoder Amusement Park
ユーザ lucsdei
言語 C++ 20 (gcc 12.2)
得点 200
コード長 611 Byte
結果 AC
実行時間 1 ms
メモリ 3664 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 1 ms 3440 KiB
00_sample_01.txt AC 1 ms 3528 KiB
00_sample_02.txt AC 1 ms 3524 KiB
01_random_03.txt AC 1 ms 3440 KiB
01_random_04.txt AC 1 ms 3528 KiB
01_random_05.txt AC 1 ms 3484 KiB
01_random_06.txt AC 1 ms 3524 KiB
01_random_07.txt AC 1 ms 3664 KiB
01_random_08.txt AC 1 ms 3404 KiB
01_random_09.txt AC 1 ms 3528 KiB
01_random_10.txt AC 1 ms 3636 KiB
01_random_11.txt AC 1 ms 3444 KiB
01_random_12.txt AC 1 ms 3660 KiB
01_random_13.txt AC 1 ms 3468 KiB
01_random_14.txt AC 1 ms 3528 KiB