結果

問題 No.497 入れ子の箱
ユーザー kuuso1kuuso1
提出日時 2017-07-04 21:59:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 1,437 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 113,308 KB
実行使用メモリ 28,132 KB
最終ジャッジ日時 2024-04-15 16:18:43
合計ジャッジ時間 3,193 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,116 KB
testcase_01 AC 28 ms
24,032 KB
testcase_02 AC 28 ms
24,308 KB
testcase_03 AC 41 ms
26,208 KB
testcase_04 AC 40 ms
26,376 KB
testcase_05 AC 42 ms
26,120 KB
testcase_06 AC 41 ms
26,120 KB
testcase_07 AC 41 ms
26,116 KB
testcase_08 AC 40 ms
24,172 KB
testcase_09 AC 41 ms
24,324 KB
testcase_10 AC 41 ms
28,132 KB
testcase_11 AC 41 ms
24,040 KB
testcase_12 AC 43 ms
24,424 KB
testcase_13 AC 43 ms
23,856 KB
testcase_14 AC 46 ms
24,160 KB
testcase_15 AC 45 ms
26,244 KB
testcase_16 AC 44 ms
24,372 KB
testcase_17 AC 45 ms
24,116 KB
testcase_18 AC 39 ms
24,108 KB
testcase_19 AC 39 ms
22,060 KB
testcase_20 AC 39 ms
23,984 KB
testcase_21 AC 38 ms
21,936 KB
testcase_22 AC 38 ms
22,068 KB
testcase_23 AC 34 ms
24,164 KB
testcase_24 AC 35 ms
24,044 KB
testcase_25 AC 30 ms
24,176 KB
testcase_26 AC 27 ms
24,108 KB
testcase_27 AC 42 ms
24,420 KB
testcase_28 AC 43 ms
22,196 KB
testcase_29 AC 43 ms
24,240 KB
testcase_30 AC 39 ms
26,100 KB
testcase_31 AC 40 ms
26,232 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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));}
}
0