結果

問題 No.2240 WAC
ユーザー simansiman
提出日時 2023-03-12 10:13:35
言語 Ruby
(3.3.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 11,912 KB
実行使用メモリ 20,136 KB
最終ジャッジ日時 2023-10-18 10:29:42
合計ジャッジ時間 6,397 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,048 KB
testcase_01 AC 89 ms
16,056 KB
testcase_02 AC 87 ms
16,052 KB
testcase_03 AC 86 ms
16,052 KB
testcase_04 AC 87 ms
16,052 KB
testcase_05 AC 85 ms
16,052 KB
testcase_06 AC 85 ms
16,052 KB
testcase_07 AC 86 ms
16,052 KB
testcase_08 AC 87 ms
16,052 KB
testcase_09 AC 86 ms
16,052 KB
testcase_10 AC 207 ms
20,136 KB
testcase_11 AC 213 ms
18,996 KB
testcase_12 AC 201 ms
19,308 KB
testcase_13 AC 87 ms
16,312 KB
testcase_14 AC 107 ms
16,688 KB
testcase_15 AC 87 ms
16,572 KB
testcase_16 AC 181 ms
18,036 KB
testcase_17 AC 158 ms
17,840 KB
testcase_18 AC 114 ms
16,720 KB
testcase_19 AC 117 ms
16,356 KB
testcase_20 AC 87 ms
16,576 KB
testcase_21 AC 142 ms
17,856 KB
testcase_22 AC 87 ms
16,312 KB
testcase_23 AC 88 ms
16,312 KB
testcase_24 AC 88 ms
16,576 KB
testcase_25 AC 169 ms
17,916 KB
testcase_26 AC 125 ms
17,520 KB
testcase_27 AC 113 ms
16,916 KB
testcase_28 AC 87 ms
16,312 KB
testcase_29 AC 88 ms
16,048 KB
testcase_30 AC 87 ms
16,312 KB
testcase_31 AC 198 ms
18,484 KB
testcase_32 AC 112 ms
17,188 KB
testcase_33 AC 155 ms
17,948 KB
testcase_34 AC 168 ms
18,568 KB
testcase_35 AC 101 ms
16,580 KB
testcase_36 AC 180 ms
18,356 KB
testcase_37 AC 88 ms
16,576 KB
testcase_38 AC 87 ms
16,312 KB
testcase_39 AC 88 ms
17,088 KB
testcase_40 AC 146 ms
17,916 KB
testcase_41 AC 86 ms
16,576 KB
testcase_42 AC 87 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[0] < l
    puts 'No'
    exit
  else
    a_pos.shift
  end
end

puts 'Yes'
0