結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー kpinkcat
提出日時 2023-08-07 06:20:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 105,332 KB
最終ジャッジ日時 2025-02-15 23:55:53
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    int n, m1, m2, cnt = 0;
    cin >> n >> m1;
    vector<int> a(n+1);
    for (int i = 0; i < m1; i++){
        int temp;
        cin >> temp;
        cnt += temp;
        a[cnt]++;
    }
    cin >> m2;  
    for (int i = 0; i < m2; i++){
        int temp;
        cin >> temp;
        cnt -= temp;
        a[cnt]++;
    }
    for (int i = 0; i < n+1; i++){
        if (!(a[i])) cnt++;
    }
    cout << cnt << endl;
}
0