結果

問題 No.1535 五七五
ユーザー atjh16atjh16
提出日時 2021-09-23 17:48:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 168,272 KB
実行使用メモリ 8,652 KB
最終ジャッジ日時 2023-09-18 19:55:35
合計ジャッジ時間 6,182 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 152 ms
8,264 KB
testcase_05 AC 226 ms
7,656 KB
testcase_06 AC 236 ms
7,468 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 199 ms
8,204 KB
testcase_19 AC 202 ms
8,652 KB
testcase_20 AC 201 ms
7,676 KB
testcase_21 AC 201 ms
7,396 KB
testcase_22 AC 201 ms
7,328 KB
testcase_23 AC 202 ms
7,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int n, m = 0;
string s;
long long a, b, c;

int main()
{
	cin >> n >> a >> b >> c;

	vector<long long> t(1, 0);

	for (int i = 0; i < n; i++) {
		cin >> s;
		t.push_back(t.back() + s.size());
	}

	t.push_back(1e18);

	for (int k = 1; k <= n; k++) {
		long long pa = *lower_bound(t.begin(), t.end(), t[k - 1] + a),
		pb = *lower_bound(t.begin(), t.end(), t[k - 1] + a + b),
		pc = *lower_bound(t.begin(), t.end(), t[k - 1] + a + b + c);

		if (pa - t[k - 1] == a && pb - t[k - 1] == a + b 
			&& pc - t[k - 1] == a + b + c) {
			m++;
		}
	}

	cout << m << endl;
}
0