結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー aogeraaogera
提出日時 2024-04-01 13:17:12
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 1,883 bytes
コンパイル時間 5,271 ms
コンパイル使用メモリ 308,436 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-04-01 13:17:19
合計ジャッジ時間 7,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 1 ms
6,548 KB
testcase_03 AC 18 ms
6,548 KB
testcase_04 AC 22 ms
6,548 KB
testcase_05 AC 7 ms
6,548 KB
testcase_06 AC 17 ms
6,548 KB
testcase_07 AC 33 ms
6,548 KB
testcase_08 AC 15 ms
6,548 KB
testcase_09 AC 4 ms
6,548 KB
testcase_10 AC 12 ms
6,548 KB
testcase_11 AC 46 ms
6,548 KB
testcase_12 AC 36 ms
6,548 KB
testcase_13 AC 3 ms
6,548 KB
testcase_14 AC 3 ms
6,548 KB
testcase_15 AC 4 ms
6,548 KB
testcase_16 AC 3 ms
6,548 KB
testcase_17 AC 3 ms
6,548 KB
testcase_18 AC 3 ms
6,548 KB
testcase_19 AC 4 ms
6,548 KB
testcase_20 AC 2 ms
6,548 KB
testcase_21 AC 3 ms
6,548 KB
testcase_22 AC 4 ms
6,548 KB
testcase_23 AC 3 ms
6,548 KB
testcase_24 AC 3 ms
6,548 KB
testcase_25 AC 2 ms
6,548 KB
testcase_26 AC 3 ms
6,548 KB
testcase_27 AC 2 ms
6,548 KB
testcase_28 AC 3 ms
6,548 KB
testcase_29 AC 3 ms
6,548 KB
testcase_30 AC 3 ms
6,548 KB
testcase_31 AC 4 ms
6,548 KB
testcase_32 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include <atcoder/all>
using namespace std;using namespace atcoder;using vst = vector<string>;using ll = long long;
using ld = long double;using pll = pair<ll,ll>;using vll = vector<ll>;using vvll = vector<vll>;
using vpll = vector<pll>;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repp(i,k,n) for (ll i = k; i < n; i++)
#define per(i,s,e) for(ll i = s; i >= e; i--)
#define all(v) v.begin(),v.end()
#define no() {cout << "No" << endl; return 0;}
#define yes(){cout << "Yes" << endl;return 0;}
#define yesno(a) a ? cout << "Yes" << endl : cout << "No" << endl
#define YESNO(a) a ? cout << "YES" << endl : cout << "NO" << endl
#define MODD 998244353LL
#define MOD 1000000007LL
#define UNOmap unordered_map
#define UNOset unordered_set
#define ASC(T) T,vector<T>,greater<T>
#define join(G,a,b) G[a].push_back(b);G[b].push_back(a);
#define PB(a,b) a.push_back(b)
template<class... T>void in(T&... a){(cin >> ... >> a);}
template<class T, class... Ts>void out(const T& a, const Ts&... b){cout << a;((cout << ' ' <<  b), ...);cout << '\n';}
void vin(vll &v){for(ll i = 0; i < (ll)v.size(); i++)in(v[i]);}
void vout(vll &v){for(ll i = 0; i < (ll)v.size(); i++) cout << v[i] << ' ';cout << "\n";}
ll INF = 1LL << 62;

// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

// using mint = modint998244353;
// using mint = modint1000000007;
// using mint = modint;


// cout << fixed << setprecision(15);
//----------------------------------------------



int main(){
  ll N,M1;
  in(N,M1);
  vll dirty(N+1);
  ll sum1 = 0;
  dirty[0] = 1;
  rep(i,M1){
    ll a;
    in(a);
    sum1+=a;
    dirty[sum1] = 1;
  }
  ll sum2 = N;
  ll M2;
  in(M2);
  dirty[sum2] = 1;
  rep(i,M2){
    ll b;
    in(b);
    sum2-=b;
    dirty[sum2] = 1;
  }
  
  ll ans = 0;
  rep(i,N+1){
    if(dirty[i])continue;
    ans++;
  }
  out(ans);
}
0