結果

問題 No.497 入れ子の箱
ユーザー phsplsphspls
提出日時 2022-12-01 00:00:04
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 821 bytes
コンパイル時間 3,188 ms
コンパイル使用メモリ 170,516 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-16 18:55:21
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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