結果
| 問題 | No.3422 Sazanka's hobby |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-11 14:08:36 |
| 言語 | Rust (1.92.0 + proconio + num) |
| 結果 |
AC
|
| 実行時間 | 208 ms / 2,000 ms |
| コード長 | 836 bytes |
| 記録 | |
| コンパイル時間 | 23,794 ms |
| コンパイル使用メモリ | 413,880 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-01-11 14:09:05 |
| 合計ジャッジ時間 | 26,940 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
use proconio::{fastout, input};
#[fastout]
fn main() {
input! {
n: usize,
m: u32,
plants: [(u32, u32); n],
}
println!("{}", output(solve(m, plants)));
}
fn prepare(m: u32, plants: Vec<(u32, u32)>) -> Vec<u32> {
plants.into_iter().map(|(a, b)| (m - a) / b).collect()
}
fn solve(m: u32, plants: Vec<(u32, u32)>) -> u32 {
let mut deadline_of = prepare(m, plants);
deadline_of.sort_unstable();
let deadline_of = deadline_of;
let mut l = 0;
let mut r = deadline_of.len();
while l + 1 < r {
let c = l.midpoint(r);
if deadline_of
.chunks(c)
.enumerate()
.all(|(i, d)| d[0] >= i as u32)
{
r = c;
} else {
l = c;
}
}
r as u32
}
fn output(ans: u32) -> u32 {
ans
}