結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー yorry2101
提出日時 2023-09-07 15:58:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 72,044 KB
最終ジャッジ日時 2025-02-16 19:14:36
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n, m1, m2;
    cin >> n;
    vector<bool> ds(n+1);
    ds[0] = true;
    ds[n] = true;
    int dsc = 2;
    cin >> m1;
    int a, ups = 0;
    for (int i = 0; i < m1; i++) {
        cin >> a;
        ups += a;
        if (!ds[ups]) {
            ds[ups] = true;
            dsc++;
        }
    }
    cin >> m2;
    int b, dws = n;
    for (int i = 0; i < m2; i++) {
        cin >> b;
        dws -= b;
        if (!ds[dws]) {
            ds[dws] = true;
            dsc++;
        }
    }
    cout << n+1 - dsc << endl;
}
0