結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー twooimp2
提出日時 2024-03-03 19:39:04
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 23,190 ms
コンパイル使用メモリ 353,680 KB
最終ジャッジ日時 2025-02-20 00:27:30
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;

void IO(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
}

int main(){
  IO();
  ll n;
  cin>>n;
  ll m1;
  cin>>m1;
  vector<bool> isd(n+1,false);
  isd[0]=true;
  ll now=0;
  for(ll i=0;i<m1;i++){
    ll a;
    cin>>a;
    now+=a;
    isd[now]=true;
  }
  ll m2;
  cin>>m2;
  for(ll i=0;i<m2;i++){
    ll b;
    cin>>b;
    now-=b;
    isd[now]=true;
  }
  ll ans=n+1;
  for(ll i=0;i<=n;i++){
    if(isd[i]){
      ans--;
    }
  }
  cout<<ans<<endl;
}
0