結果
| 問題 |
No.497 入れ子の箱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-24 22:59:21 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 1,001 ms |
| コンパイル使用メモリ | 134,352 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 18:32:45 |
| 合計ジャッジ時間 | 1,612 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
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.reduce!max.writeln;
}