結果

問題 No.1597 Matrix Sort
ユーザー olpheolphe
提出日時 2021-07-09 21:41:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,194 bytes
コンパイル時間 950 ms
コンパイル使用メモリ 111,320 KB
実行使用メモリ 315,848 KB
最終ジャッジ日時 2023-09-14 08:13:44
合計ジャッジ時間 6,541 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 303 ms
315,660 KB
testcase_04 AC 200 ms
315,708 KB
testcase_05 AC 200 ms
315,512 KB
testcase_06 AC 196 ms
315,500 KB
testcase_07 AC 199 ms
315,512 KB
testcase_08 AC 179 ms
315,848 KB
testcase_09 AC 182 ms
315,572 KB
testcase_10 AC 128 ms
315,700 KB
testcase_11 AC 133 ms
315,444 KB
testcase_12 RE -
testcase_13 AC 62 ms
34,336 KB
testcase_14 AC 196 ms
315,508 KB
testcase_15 RE -
testcase_16 AC 37 ms
34,328 KB
testcase_17 AC 150 ms
315,492 KB
testcase_18 AC 198 ms
315,504 KB
testcase_19 AC 181 ms
315,444 KB
testcase_20 AC 142 ms
315,400 KB
testcase_21 AC 134 ms
315,708 KB
testcase_22 AC 132 ms
315,412 KB
testcase_23 AC 129 ms
315,692 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 111 ms
315,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> K >> M;
	vector<long long>a(2 * M);
	vector<long long>b(2 * M);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> L;
		b[L]++;
		b[L + M]++;
	}
	for (int i = 1; i < 2 * M; i++) {
		b[i] += b[i - 1];
	}
	L = -1, R = M - 1;
	while (R - L > 1) {
		int mid = (L + R) / 2;
		long long num = 0;
		for (int i = 0; i < N; i++) {
			num += b[M + mid - a[i]] - b[M - a[i] - 1];
		}
		if (num < K)L = mid;
		else R = mid;
	}
	cout << R << endl;
}
0