結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	int M1;
	cin >> M1;
	vector<int> A(M1);
	for (int i = 0; i < M1; i++){
		cin >> A[i];
	}
	int M2;
	cin >> M2;
	vector<int> B(M2);
	for (int i = 0; i < M2; i++){
		cin >> B[i];
	}
	vector<bool> flg(N + 1);
	flg[0] = true;
	int c = 0;
	for (int i = 0; i < M1; i++){
		c += A[i];
		flg[c] = true;
	}
	for (int i = 0; i < M2; i++){
		c -= B[i];
		flg[c] = true;
	}
	cout << count(flg.begin(), flg.end(), false) << '\n';
}
0