結果
問題 | No.548 国士無双 |
ユーザー |
|
提出日時 | 2023-05-23 12:27:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 2,171 ms |
コンパイル使用メモリ | 174,280 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 01:04:11 |
合計ジャッジ時間 | 2,680 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:16:20: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 16 | for (const auto& [key, value] : dic) { | ^
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string S; cin >> S; string alpha = "abcdefghijklm"; map<char,int> dic; for(int i = 0; i < S.size(); i++) { dic[alpha[i]] = 0; } for(int i = 0; i < S.size(); i++) { dic[S[i]]++; } string ans = ""; int an = 0; for (const auto& [key, value] : dic) { if(value == 0) { ans = key; an++; } } if(an > 1) { cout << "Impossible" << endl; return 0; } if(ans == "") { for(int i = 0; i < alpha.size(); i++) { cout << alpha[i] << endl; } }else { cout << ans << endl; } }