結果

問題 No.497 入れ子の箱
ユーザー phspls
提出日時 2022-12-01 00:00:04
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 821 bytes
コンパイル時間 15,550 ms
コンパイル使用メモリ 379,896 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 19:32:00
合計ジャッジ時間 15,560 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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 temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
            (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());
}
0