結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 1000000007;
//const int mod = 998244353;

int main()
{
  int n;
  cin >> n;
  int m1;
  cin >> m1;
  vector<int> a(m1);
  rep(i, 0, m1) cin >> a[i];
  int m2;
  cin >> m2;
  vector<int> b(m2);
  rep(i, 0, m2) cin >> b[i];
  set<int> st;
  int now = 0;
  rep(i, 0, m1) {
    now += a[i];
    st.insert(now);
  }
  rep(i, 0, m2) {
    now -= b[i];
    st.insert(now);
  }
  cout << n - st.size() + 1 << endl;
  return 0;
}
0