結果
| 問題 |
No.2268 NGワード回避
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-14 23:53:26 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 400 bytes |
| コンパイル時間 | 280 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 13,696 KB |
| 最終ジャッジ日時 | 2024-10-10 14:53:55 |
| 合計ジャッジ時間 | 7,018 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
NGWords = Array.new(N) { gets.chomp }.uniq
matching = [* 0 ... NGWords.size]
ans = ""
N.times do |j|
a = []
b = []
matching.each do |i|
if NGWords[i][j] == 'a'
a << i
else
b << i
end
end
if a.size <= b.size
matching = a
ans << 'a'
else
matching = b
ans << 'b'
end
end
puts ans