結果

問題 No.497 入れ子の箱
ユーザー kuuso1
提出日時 2017-07-04 22:02:53
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 107,648 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2024-10-05 16:13:47
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[] dp = new int[N];
		for(int i=0;i<N;i++) dp[i] = 1;
		
		for(int i=0;i<N;i++){
			int[] nxt = new int[N];
			for(int j=0;j<N;j++){
				if(canGo(B[j],B[i])){
					nxt[i] = Math.Max(nxt[i],dp[j]+1);
				}
			}
			dp = nxt;
		}
		Console.WriteLine(dp.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