提出 #32549664


ソースコード 拡げる

#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define put(i) cout << i << endl
#define rep(i, s, n) for (long long i = s; i < (long long)(n); i++)
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) { cin >> a[i], a[i]; }

    ll p = 0;
    deque<ll> d;
    vector<ll> b = {0, 0, 0, 0};
    rep(i, 0, n) {
        b[0] = 1;
        vector<ll> tmp = {0, 0, 0, 0};
        rep(j, 0, 4) {
            if (!b[j]) continue;
            if (a[i] + j > 3) {
                p += 1;
                b[j] = 0;
            } else {
                b[j] = 0;
                tmp[j + a[i]] = 1;
            }
        }

        b = tmp;
        //rep(j, 0, 4) { cout << b[j] << " "; }
        //cout << endl;
        //cout << endl;
    }

    put(p);
}

提出情報

提出日時
問題 B - Batters
ユーザ aoken_7
言語 C++ (GCC 9.2.1)
得点 200
コード長 822 Byte
結果 AC
実行時間 8 ms
メモリ 3600 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 10
セット名 テストケース
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_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 02_max_00.txt, 03_min_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 8 ms 3592 KiB
00_sample_01.txt AC 2 ms 3432 KiB
00_sample_02.txt AC 2 ms 3596 KiB
01_random_00.txt AC 2 ms 3568 KiB
01_random_01.txt AC 2 ms 3512 KiB
01_random_02.txt AC 2 ms 3596 KiB
01_random_03.txt AC 6 ms 3436 KiB
01_random_04.txt AC 3 ms 3600 KiB
02_max_00.txt AC 2 ms 3544 KiB
03_min_00.txt AC 2 ms 3600 KiB