結果
| 問題 |
No.3325 陰陽師
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-01 15:13:07 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 440 ms / 2,000 ms |
| コード長 | 831 bytes |
| コンパイル時間 | 1,385 ms |
| コンパイル使用メモリ | 112,828 KB |
| 実行使用メモリ | 18,688 KB |
| 最終ジャッジ日時 | 2025-11-01 15:13:23 |
| 合計ジャッジ時間 | 12,054 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
void chmax(int &a, int b) {
if (a < b) a = b;
}
int main() {
int N, M;
std::cin >> N >> M;
std::vector<int> S(N), T(M);
for (int &s : S) std::cin >> s;
for (int &t : T) std::cin >> t;
std::multiset<int> set(S.begin(), S.end());
int best = 0;
for (int t : T) {
auto iter = set.lower_bound(t);
if (iter == set.end()) break;
set.erase(iter);
best++;
}
T.resize(best);
std::sort(T.begin(), T.end());
set = std::multiset<int>(S.begin(), S.end());
int result = 0;
for (int t : T) {
auto iter = set.lower_bound(t);
if (iter == set.end()) break;
chmax(result, *iter - t);
set.erase(iter);
}
std::cout << result << std::endl;
}