結果
| 問題 |
No.1597 Matrix Sort
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-09 21:41:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,194 bytes |
| コンパイル時間 | 1,009 ms |
| コンパイル使用メモリ | 113,384 KB |
| 実行使用メモリ | 315,744 KB |
| 最終ジャッジ日時 | 2024-07-01 15:38:59 |
| 合計ジャッジ時間 | 7,239 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 RE * 4 |
ソースコード
#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;
}