結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2020-05-11 15:54:18 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 383 bytes |
| コンパイル時間 | 46 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-07-18 12:24:54 |
| 合計ジャッジ時間 | 3,180 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
コンパイルメッセージ
Syntax OK
ソースコード
S = gets.chomp
counter = Hash.new(0)
S.chars.sort.each do |ch|
counter[ch] += 1
end
corrects = []
base = 'abcdefghijklm'
base.chars.each do |ch|
cand = (base + ch).chars.sort.join
corrects << cand
end
ans = []
base.chars.each do |ch|
t = (S + ch).chars.sort.join
if corrects.include?(t)
ans << ch
end
end
if ans.empty?
puts 'Impossible'
else
puts ans
end
siman