結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
tsuchinaga
|
| 提出日時 | 2019-03-01 13:53:36 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 688 bytes |
| コンパイル時間 | 11,889 ms |
| コンパイル使用メモリ | 221,824 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-17 14:56:39 |
| 合計ジャッジ時間 | 12,629 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
package main
import "fmt"
func main() {
s, t := "", "abcdefghijklm"
_, _ = fmt.Scan(&s)
m := make(map[string]int, 0)
for _, c := range []rune(t) {
m[string(c)] = 0
}
max := 0
cnt := 0
for _, c := range []rune(s) {
if _, ok := m[string(c)]; !ok {
fmt.Println("Impossible")
return
}
m[string(c)]++
if max < m[string(c)] {
max = m[string(c)]
cnt = 1
} else if max == m[string(c)] {
cnt++
}
}
if max >= 3 || (max == 2 && cnt >= 2) {
fmt.Println("Impossible")
} else if max == 2 && cnt == 1 {
for k, v := range m {
if v == 0 {
fmt.Println(k)
break
}
}
} else {
for _, c := range []rune(t) {
fmt.Println(string(c))
}
}
}
tsuchinaga