結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー Maffy-0
提出日時 2024-03-21 17:11:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 193,460 KB
最終ジャッジ日時 2025-02-20 10:39:28
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void fast_io() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
}

signed main(void) {
    fast_io();
    int N;
    cin >> N;
    vector<int> D(N + 1);
    D[0] = D[N] = 1;
    int M;
    cin >> M;
    int now = 0;
    for (int i = 0; i < M; i++) {
        int A;
        cin >> A;
        now += A;
        D[now] = 1;
    }
    assert(now == N);
    int L;
    cin >> L;
    for (int i = 0; i < L; i++) {
        int B;
        cin >> B;
        now -= B;
        D[now] = 1;
    }
    assert(now == 0);
    int ans = 0;
    for (int i = 0; i <= N; i++) {
        if (D[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}
0