結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー kekenx
提出日時 2023-08-07 22:57:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 194,620 KB
最終ジャッジ日時 2025-02-16 00:03:05
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int n;
  cin >> n;
  vector<bool> dirty(n + 1, false);
  dirty[0] = true;
  int m;
  cin >> m;
  int cur = 0;
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    cur += a;
    dirty[cur] = true;
  }

  cin >> m;
  for (int i = 0; i < m; i++) {
    int b;
    cin >> b;
    cur -= b;
    dirty[cur] = true;
  }

  int ans = 0;
  for (const auto &d : dirty) {
    ans += !d;
  }
  cout << ans << '\n';
  return 0;
}

0