結果
問題 | No.548 国士無双 |
ユーザー |
![]() |
提出日時 | 2022-05-18 21:25:26 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 1,441 ms |
コンパイル使用メモリ | 169,576 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 15:13:29 |
合計ジャッジ時間 | 2,214 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
import std; void main() { auto S = readln.chomp; int L = 13; auto cnts = new int[](3); auto list = new int[](L); foreach (s; S) { ++list[s-'a']; if (list[s-'a'] == 1) ++cnts[0]; else if (list[s-'a'] == 2) --cnts[0], ++cnts[1]; else ++cnts[2]; } if (cnts[2] > 0 || cnts[1] > 1) { writeln("Impossible"); return; } foreach (i; 0 .. L) { if (cnts[1] == 0 && list[i] == 1) to!dchar(i+'a').writeln; if (cnts[1] == 1 && list[i] == 0) to!dchar(i+'a').writeln; } }