結果
問題 |
No.1665 quotient replace
|
ユーザー |
|
提出日時 | 2021-09-03 22:48:34 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 722 bytes |
コンパイル時間 | 381 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 622,368 KB |
最終ジャッジ日時 | 2024-12-15 16:02:13 |
合計ジャッジ時間 | 122,428 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 2 RE * 2 TLE * 27 MLE * 2 |
コンパイルメッセージ
Main.rb:28: warning: assigned but unused variable - n Syntax OK
ソースコード
require 'prime' # https://yukicoder.me/submissions/174004 @dp={} def guchoku216(aa,turn=true) return !turn if aa.size == 0 aa.sort! return @dp[aa+[turn]] if @dp[aa+[turn]] aa.each_index{|i| ac = aa.clone ac[i]-=1 while ac[i] > 0 return @dp[aa+[turn]] = turn if (guchoku216(ac.clone,!turn) == turn) ac[i]-=1 end ac.delete(0) return @dp[aa+[turn]] = turn if (guchoku216(ac.clone,!turn) == turn) } return @dp[aa+[turn]] = !turn end def game(n) guchoku216(n.prime_division.map{|e|e[1]}) end n = gets.to_i puts guchoku216(gets.split.map(&:to_i).map{|e| e.prime_division.map{|e|e[1]}}.flatten!) ? 'white' : 'black'