AtCoder Grand Contest 009

Submission #1076373

Source codeソースコード

if !ENV['RUBY_THREAD_VM_STACK_SIZE']
	require 'rubygems';RUBY=Gem.ruby
	exec({'RUBY_THREAD_VM_STACK_SIZE'=>'50000000'},RUBY,$0)
end

def dfs(i)
	return 0 if !H.has_key?(i)
	return $memo[i] if $memo[i]>=0
	a=H[i].map{|e|dfs(e)}.sort_by(&:-@)
	r=0
	a.size.times{|i|x=a[i]+i+1;r<x&&r=x}
	$memo[i]=r
end
N=gets.to_i
$memo=[-1]*N
H=Hash.new{|h,k|h[k]=[]}
$<.each_with_index{|e,i|
	H[e.to_i-1]<<i+1
}
dfs(N/2)
p dfs(0)

Submission

Task問題 B - Tournament
User nameユーザ名 002_ciel
Created time投稿日時
Language言語 Ruby (2.3.3)
Status状態 AC
Score得点 800
Source lengthソースコード長 432 Byte
File nameファイル名
Exec time実行時間 1842 ms
Memory usageメモリ使用量 125564 KB

Compiler messageコンパイルメッセージ

./Main.rb:11: warning: shadowing outer local variable - i

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt,s3.txt
All 800 / 800 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,09.txt,10.txt,11.txt,12.txt,13.txt,14.txt,15.txt,16.txt,17.txt,18.txt,19.txt,20.txt,21.txt,22.txt,23.txt,24.txt,25.txt,26.txt,27.txt,28.txt,29.txt,30.txt,31.txt,32.txt,33.txt,34.txt,35.txt,36.txt,37.txt,38.txt,39.txt,40.txt,41.txt,42.txt,43.txt,44.txt,45.txt,46.txt,47.txt,48.txt,49.txt,50.txt,s1.txt,s2.txt,s3.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 301 ms 12672 KB
02.txt AC 285 ms 12288 KB
03.txt AC 289 ms 12292 KB
04.txt AC 283 ms 12292 KB
05.txt AC 277 ms 12296 KB
06.txt AC 278 ms 12280 KB
07.txt AC 280 ms 12288 KB
08.txt AC 276 ms 12288 KB
09.txt AC 293 ms 12284 KB
10.txt AC 280 ms 12284 KB
11.txt AC 766 ms 125564 KB
12.txt AC 1842 ms 89220 KB
13.txt AC 564 ms 72324 KB
14.txt AC 494 ms 53376 KB
15.txt AC 531 ms 67460 KB
16.txt AC 428 ms 45568 KB
17.txt AC 346 ms 29052 KB
18.txt AC 300 ms 19588 KB
19.txt AC 302 ms 16644 KB
20.txt AC 292 ms 16004 KB
21.txt AC 188 ms 8960 KB
22.txt AC 185 ms 8088 KB
23.txt AC 184 ms 7864 KB
24.txt AC 180 ms 7744 KB
25.txt AC 180 ms 7820 KB
26.txt AC 179 ms 7620 KB
27.txt AC 178 ms 7668 KB
28.txt AC 173 ms 7552 KB
29.txt AC 174 ms 7420 KB
30.txt AC 176 ms 7676 KB
31.txt AC 261 ms 11140 KB
32.txt AC 231 ms 10240 KB
33.txt AC 224 ms 12420 KB
34.txt AC 206 ms 11260 KB
35.txt AC 192 ms 11524 KB
36.txt AC 177 ms 7932 KB
37.txt AC 175 ms 8328 KB
38.txt AC 170 ms 7424 KB
39.txt AC 172 ms 7296 KB
40.txt AC 174 ms 7556 KB
41.txt AC 79 ms 4216 KB
42.txt AC 79 ms 4216 KB
43.txt AC 78 ms 4216 KB
44.txt AC 79 ms 4216 KB
45.txt AC 78 ms 4216 KB
46.txt AC 80 ms 4216 KB
47.txt AC 80 ms 4216 KB
48.txt AC 79 ms 4216 KB
49.txt AC 79 ms 4216 KB
50.txt AC 79 ms 4216 KB
s1.txt AC 79 ms 4216 KB
s2.txt AC 79 ms 4232 KB
s3.txt AC 80 ms 4216 KB