結果
| 問題 | No.497 入れ子の箱 |
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2017-07-04 21:59:15 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 5,000 ms |
| コード長 | 1,437 bytes |
| 記録 | |
| コンパイル時間 | 1,034 ms |
| コンパイル使用メモリ | 109,924 KB |
| 実行使用メモリ | 18,688 KB |
| 最終ジャッジ日時 | 2024-10-05 16:12:54 |
| 合計ジャッジ時間 | 3,162 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
int max = 0;
memo = new int[N];
for(int i=0;i<N;i++){
max = Math.Max(max,dfs(i));
}
Console.WriteLine(max);
}
int[] memo;
int dfs(int now){
if(memo[now] != 0) return memo[now];
int max = 1;
for(int to=0;to<N;to++){
if(canGo(B[now],B[to])){
max = Math.Max(max,dfs(to) + 1);
}
}
return memo[now] = max;
}
bool canGo(int[] from, int[] to){
return from[0] < to[0] && from[1] < to[1] && from[2] < to[2] ;
}
int N;
int[][] B;
public Sol(){
N = ri();
B = new int[N][];
for(int i=0;i<N;i++) { B[i] = ria(); Array.Sort(B[i]); }
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
kuuso1