結果

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

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,m1;
  cin>>n>>m1;
  vector<int> A(m1);
  rep(i,m1) cin>>A[i];
  int m2;
  cin>>m2;
  vector<int> B(m2);
  rep(i,m2) cin>>B[i];
  
  vector<int> C(n+1);
  int now=0;
  C[0]=1;
  rep(i,m1){
    now+=A[i];
    C[now]=1;
  }
  rep(i,m2){
    now-=B[i];
    C[now]=1;
  }
  int cnt=0;
  rep(i,n){
    if(C[i]==0) cnt++;
  }
  cout<<cnt<<endl;
  
  return 0;
}
0