結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-12-21 21:29:32
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 330 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 24,596 KB
最終ジャッジ日時 2023-10-21 11:51:20
合計ジャッジ時間 12,500 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,088 KB
testcase_01 AC 86 ms
16,088 KB
testcase_02 AC 85 ms
16,088 KB
testcase_03 AC 86 ms
16,088 KB
testcase_04 AC 86 ms
16,088 KB
testcase_05 AC 86 ms
16,088 KB
testcase_06 AC 85 ms
16,088 KB
testcase_07 AC 85 ms
16,088 KB
testcase_08 AC 84 ms
16,088 KB
testcase_09 AC 85 ms
16,088 KB
testcase_10 AC 86 ms
16,088 KB
testcase_11 AC 85 ms
16,088 KB
testcase_12 AC 85 ms
16,088 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 1,438 ms
19,908 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 152 ms
18,348 KB
testcase_34 AC 103 ms
18,348 KB
testcase_35 AC 1,589 ms
18,348 KB
testcase_36 AC 255 ms
18,348 KB
testcase_37 AC 311 ms
18,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
S = "o#{gets.chomp}x"
MEMO = Array.new(N + 1)

def min(a,b); a < b ? a : b; end
def win?(n)
  return MEMO[min(n,N)] = true if n >= N || S[n] == 'x'
  return MEMO[n] unless MEMO[n].nil?
  MEMO[n] = !(1 .. K).all?{|i| win?(n + i) }
end

if win?(0)
  puts (1 .. K).reject{|i| MEMO[i] }
else
  puts 0
end
0