結果
問題 | No.587 七対子 |
ユーザー | はまやんはまやん |
提出日時 | 2017-11-03 22:27:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,596 bytes |
コンパイル時間 | 1,880 ms |
コンパイル使用メモリ | 173,580 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:39:17 |
合計ジャッジ時間 | 2,764 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
main.cpp: In function 'std::string solve()': main.cpp:36:16: warning: 'one_c' may be used uninitialized [-Wmaybe-uninitialized] 36 | ans[0] = one_c; main.cpp:27:32: note: 'one_c' was declared here 27 | int one = 0, two = 0; char one_c; | ^~~~~
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ string S; //--------------------------------------------------------------------------------------------------- #define NO "Impossible" string solve() { map<char, int> cnt; fore(c, S) cnt[c]++; int one = 0, two = 0; char one_c; fore(p, cnt) { if (p.second == 1) one++, one_c = p.first; else if (p.second == 2) two++; else return NO; } if (one == 1 and two == 6) { string ans = "a"; ans[0] = one_c; return ans; } return NO; } //--------------------------------------------------------------------------------------------------- void _main() { cin >> S; cout << solve() << endl; }