結果
問題 |
No.548 国士無双
|
ユーザー |
|
提出日時 | 2020-06-20 12:09:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 1,775 ms |
コンパイル使用メモリ | 181,128 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 17:04:14 |
合計ジャッジ時間 | 2,644 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define all(x) (x).begin(),(x).end() int main(){ string s; cin>>s; int n=s.size(); sort(all(s)); set<char> st; for(auto x:s) st.insert(x); if(st.size()<12) {cout<<"Impossible"<<endl; return 0;} if(st.size()==13){for(auto x:s) cout<<x<<endl; return 0;} vector<pair<int, char>> vp(n); rep(i,13) vp[i].second='a'+i; rep(i,n){ rep(j,n){if(s[i]==vp[j].second) vp[j].first++;} } sort(all(vp)); cout << vp[0].second << endl; }