結果
問題 |
No.497 入れ子の箱
|
ユーザー |
|
提出日時 | 2022-12-01 00:01:07 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 850 bytes |
コンパイル時間 | 11,757 ms |
コンパイル使用メモリ | 388,944 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-07 19:33:45 |
合計ジャッジ時間 | 12,984 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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[0], temp[1], temp[2]) }) .collect::<Vec<_>>(); boxes.sort(); let mut result = vec![1usize; n]; for i in 1..n { let (lx, ly, lz) = boxes[i]; for j in 0..i { let (rx, ry, rz) = boxes[j]; if lx > rx && ly > ry && lz > rz { result[i] = result[i].max(result[j] + 1); } } } println!("{}", result.iter().max().unwrap()); }