結果
| 問題 |
No.2240 WAC
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-03-12 10:10:29 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 366 bytes |
| コンパイル時間 | 559 ms |
| コンパイル使用メモリ | 7,168 KB |
| 実行使用メモリ | 16,512 KB |
| 最終ジャッジ日時 | 2024-09-18 06:56:33 |
| 合計ジャッジ時間 | 6,633 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 WA * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
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'
siman