結果

問題 No.989 N×Mマス計算(K以上)
ユーザー square1001square1001
提出日時 2020-02-14 21:24:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 78,348 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-07-28 17:21:01
合計ジャッジ時間 2,780 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,512 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 36 ms
4,380 KB
testcase_11 AC 33 ms
4,380 KB
testcase_12 AC 41 ms
4,380 KB
testcase_13 AC 22 ms
4,380 KB
testcase_14 AC 55 ms
4,380 KB
testcase_15 AC 16 ms
4,376 KB
testcase_16 AC 29 ms
4,376 KB
testcase_17 AC 21 ms
4,376 KB
testcase_18 AC 22 ms
4,380 KB
testcase_19 AC 34 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int N, M, K; string op;
	cin >> N >> M >> K >> op;
	vector<int> B(M), A(N);
	for (int i = 0; i < M; ++i) cin >> B[i];
	for (int i = 0; i < N; ++i) cin >> A[i];
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		int least = (op == "+" ? K - A[i] : (K + A[i] - 1) / A[i]);
		ans += B.end() - lower_bound(B.begin(), B.end(), least);
	}
	cout << ans << endl;
	return 0;
}
0