結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー achapiachapi
提出日時 2023-08-04 21:27:16
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 203,768 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 19:23:46
合計ジャッジ時間 3,026 ms
ジャッジサーバー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