結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー 👑 amentorimaru
提出日時 2023-06-29 21:44:25
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 2,764 ms
コンパイル使用メモリ 121,472 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 11:45:28
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll n;
  cin >> n;
  vector<bool> foot(n);
  ll m;
  cin >> m;
  ll now = 0;
  for (ll i = 0; i < m; i++) {
    ll a;
    cin >> a;
    foot[now] = true;
    now += a;
  }

  cin >> m;
  for (ll i = 0; i < m; i++) {
    ll b;
    cin >> b;
    now -= b;
    foot[now] = true;
  }

  ll ans = 0;
  for (ll i = 0; i < n; i++)
    ans += !foot[i];
  cout << ans << "\n";
}
0