結果

問題 No.437 cwwゲーム
ユーザー suppy193suppy193
提出日時 2016-11-02 13:22:46
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,464 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-08-16 12:36:10
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,152 KB
testcase_01 AC 81 ms
15,276 KB
testcase_02 AC 80 ms
15,264 KB
testcase_03 AC 77 ms
15,156 KB
testcase_04 AC 79 ms
15,088 KB
testcase_05 AC 88 ms
15,224 KB
testcase_06 AC 114 ms
15,368 KB
testcase_07 AC 113 ms
15,156 KB
testcase_08 AC 109 ms
15,224 KB
testcase_09 AC 113 ms
15,276 KB
testcase_10 AC 106 ms
15,360 KB
testcase_11 AC 78 ms
15,164 KB
testcase_12 AC 83 ms
15,040 KB
testcase_13 AC 84 ms
15,284 KB
testcase_14 AC 82 ms
15,364 KB
testcase_15 AC 122 ms
15,152 KB
testcase_16 AC 81 ms
15,312 KB
testcase_17 AC 80 ms
15,152 KB
testcase_18 AC 80 ms
15,044 KB
testcase_19 WA -
testcase_20 AC 79 ms
15,156 KB
testcase_21 AC 79 ms
15,348 KB
testcase_22 AC 79 ms
15,236 KB
testcase_23 AC 80 ms
15,036 KB
testcase_24 AC 79 ms
15,276 KB
testcase_25 AC 80 ms
15,308 KB
testcase_26 AC 80 ms
15,036 KB
testcase_27 AC 78 ms
15,344 KB
testcase_28 AC 78 ms
15,040 KB
testcase_29 AC 78 ms
15,316 KB
testcase_30 AC 79 ms
15,152 KB
testcase_31 AC 78 ms
15,316 KB
testcase_32 AC 79 ms
15,304 KB
testcase_33 AC 81 ms
15,180 KB
testcase_34 AC 79 ms
15,044 KB
testcase_35 AC 78 ms
15,032 KB
testcase_36 AC 78 ms
15,112 KB
testcase_37 AC 79 ms
15,280 KB
testcase_38 AC 79 ms
15,088 KB
testcase_39 AC 78 ms
15,280 KB
testcase_40 AC 78 ms
15,088 KB
testcase_41 AC 80 ms
15,252 KB
testcase_42 AC 80 ms
15,124 KB
testcase_43 AC 81 ms
15,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - score
Syntax OK

ソースコード

diff #

a = gets.strip.split('').map(&:to_i)
#p a
score = 0
@max_score = 0

def dfs(a, score)
	(0...a.length).to_a.combination(3) do |set|
		#p set
		#p a
		subscore = 0
		if a[set[0]] != a[set[1]] && a[set[1]] == a[set[2]]
			#print "#{a[set[0]]}#{a[set[1]]}#{a[set[2]]}\n"
			subscore = (a[set[0]].to_s + a[set[1]].to_s + a[set[2]].to_s).to_i
			#p score + subscore
			if score + subscore > @max_score
				@max_score = score + subscore
			end
			next_a = a.clone
			#p set
			set.each do |index|
				#p next_a
				#print "index #{index}\n"
				next_a[index] = nil
			end
			next_a.compact!
			#p next_a
			dfs(next_a, score + subscore)
		end
	end
end

dfs(a, 0)
p @max_score
0