結果
| 問題 |
No.497 入れ子の箱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-25 01:27:07 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 844 bytes |
| コンパイル時間 | 13,509 ms |
| コンパイル使用メモリ | 386,580 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 13:23:00 |
| 合計ジャッジ時間 | 15,156 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
fn main() {
let mut n = String::new();
std::io::stdin().read_line(&mut n).ok();
let n: usize = n.trim().parse().unwrap();
let mut boxes = (0..n).map(|_| {
let mut temp = String::new();
std::io::stdin().read_line(&mut temp).ok();
let mut temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
temp.sort();
(temp[2], temp[1], temp[0])
})
.collect::<Vec<_>>();
boxes.sort();
let mut result = vec![1usize; n];
for i in 1..n {
let (x, y, z) = boxes[i];
for j in 0..i {
let (px, py, pz) = boxes[j];
if x > px && y > py && z > pz {
result[i] = result[i].max(1 + result[j]);
}
}
}
println!("{}", result.iter().max().unwrap());
}