結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー SSRS
提出日時 2023-08-04 21:22:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 168,272 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 19:11:41
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<bool> used(N + 1, false);
  used[0] = true;
  int M1;
  cin >> M1;
  int p = 0;
  for (int i = 0; i < M1; i++){
    int A;
    cin >> A;
    p += A;
    used[p] = true;
  }
  int M2;
  cin >> M2;
  for (int i = 0; i < M2; i++){
    int B;
    cin >> B;
    p -= B;
    used[p] = true;
  }
  int ans = 0;
  for (int i = 0; i <= N; i++){
    if (!used[i]){
      ans++;
    }
  }
  cout << ans << endl;
}
0