結果

問題 No.497 入れ子の箱
ユーザー nebukuro09nebukuro09
提出日時 2017-03-24 22:58:08
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 788 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 118,316 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 12:38:00
合計ジャッジ時間 1,866 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

alias Tuple!(int, "x", int, "y", int, "z") Box;

void main() {
    auto N = readln.chomp.to!int;
    auto B = new Box[](N);
    foreach (i; 0..N) {
        auto s = readln.split.map!(to!int).array;
        s.sort!"a > b"();
        B[i] = Box(s[0], s[1], s[2]);
    }
    B.sort!"a.x == b.x ? a.y > b.y : a.x > b.x"();

    auto dp = new int[](N);
    fill(dp, 1);

    foreach (i; 1..N) {
        foreach (j; 0..i) {
            if (B[i].x < B[j].x && B[i].y < B[j].y && B[i].z < B[j].z) {
                dp[i] = max(dp[i], dp[j]+1);
            }
        }
    }

    dp[N-1].writeln;
}
0