結果
| 問題 |
No.2401 Dirty Shoes and Stairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-04 21:27:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 2,350 ms |
| コンパイル使用メモリ | 193,888 KB |
| 最終ジャッジ日時 | 2025-02-15 22:18:03 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int m1;
cin >> m1;
vector<int> up(m1);
for (int i=0;i<m1;++i) cin >> up[i];
int m2;
cin >> m2;
vector<int> down(m2);
for (int i=0;i<m2;++i) cin >> down[i];
vector<int> a(n+1, 0);
int now {0};
a[now] = 1;
for (int i=0;i<m1;++i) {
now += up[i];
a[now] = 1;
}
for (int i=0;i<m2;++i) {
now -= down[i];
a[now] = 1;
}
int ans {};
for (int i=0;i<=n;++i) if (a[i] == 0) ++ans;
cout << ans << '\n';
}