結果
| 問題 | No.3759 Watch Fireworks |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-09 23:45:40 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,070 bytes |
| 記録 | |
| コンパイル時間 | 3,140 ms |
| コンパイル使用メモリ | 204,700 KB |
| 実行使用メモリ | 22,292 KB |
| 最終ジャッジ日時 | 2026-10-09 23:45:48 |
| 合計ジャッジ時間 | 7,427 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 12 |
ソースコード
use std::collections::BTreeSet;
use itertools::Itertools;
use proconio::input;
const INF: i64 = 10_i64.pow(10);
fn main() {
input! {
n: usize,
mut xy: [(i64, i64); n],
}
let mut xy = xy.iter().map(|&(x, y)| (x - y, x + y)).collect_vec();
xy.sort_unstable();
let mut min_d = INF;
let mut set1 = BTreeSet::<(i64, usize)>::new();
let mut set2 =
BTreeSet::<(i64, usize)>::from_iter(xy.iter().enumerate().map(|(i, v)| (v.1, i)));
for (i, &(_, y)) in xy.iter().enumerate() {
let d1 = if i == 0 {
0
} else {
let min_y = set1.first().unwrap().0;
let max_y = set1.last().unwrap().0;
(xy[i - 1].0 - xy[0].0).max(max_y - min_y)
};
let d2 = {
let min_y = set2.first().unwrap().0;
let max_y = set2.last().unwrap().0;
(xy[n - 1].0 - xy[i].0).max(max_y - min_y)
};
min_d = min_d.min(d1.max(d2));
set1.insert((y, i));
set2.remove(&(y, i));
}
println!("{min_d}");
}