結果

問題 No.2240 WAC
ユーザー simansiman
提出日時 2023-03-12 10:10:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 20,092 KB
最終ジャッジ日時 2023-10-18 10:29:36
合計ジャッジ時間 6,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
16,052 KB
testcase_01 AC 86 ms
16,052 KB
testcase_02 AC 86 ms
16,052 KB
testcase_03 AC 86 ms
16,052 KB
testcase_04 AC 90 ms
16,052 KB
testcase_05 AC 85 ms
16,052 KB
testcase_06 AC 86 ms
16,052 KB
testcase_07 AC 86 ms
16,052 KB
testcase_08 AC 87 ms
16,052 KB
testcase_09 AC 87 ms
16,052 KB
testcase_10 AC 201 ms
20,092 KB
testcase_11 AC 203 ms
18,732 KB
testcase_12 WA -
testcase_13 AC 86 ms
16,308 KB
testcase_14 AC 107 ms
16,688 KB
testcase_15 AC 87 ms
16,576 KB
testcase_16 AC 178 ms
18,036 KB
testcase_17 WA -
testcase_18 AC 112 ms
16,720 KB
testcase_19 AC 114 ms
16,356 KB
testcase_20 AC 86 ms
16,576 KB
testcase_21 AC 137 ms
17,856 KB
testcase_22 AC 87 ms
16,312 KB
testcase_23 AC 86 ms
16,312 KB
testcase_24 AC 88 ms
16,576 KB
testcase_25 AC 165 ms
17,916 KB
testcase_26 WA -
testcase_27 AC 110 ms
16,916 KB
testcase_28 AC 86 ms
16,312 KB
testcase_29 AC 87 ms
16,052 KB
testcase_30 AC 86 ms
16,312 KB
testcase_31 WA -
testcase_32 AC 110 ms
17,188 KB
testcase_33 AC 149 ms
17,948 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 168 ms
18,356 KB
testcase_37 AC 84 ms
16,576 KB
testcase_38 AC 84 ms
16,312 KB
testcase_39 AC 85 ms
17,088 KB
testcase_40 WA -
testcase_41 AC 85 ms
16,576 KB
testcase_42 AC 85 ms
16,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
S = gets.chomp

a_pos = []
w_pos = []

S.each_char.with_index do |s, i|
  case s
  when 'W'
    w_pos << i
  when 'A'
    a_pos << i
  else
    if a_pos.empty?
      puts 'No'
      exit
    else
      a_pos.shift
    end
  end
end

until w_pos.empty?
  l = w_pos.shift

  if a_pos.last < l
    puts 'No'
    exit
  end
end

puts 'Yes'
0