結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2017-11-04 00:10:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,173 bytes |
コンパイル時間 | 1,621 ms |
コンパイル使用メモリ | 171,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 01:03:36 |
合計ジャッジ時間 | 2,865 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 WA * 2 |
ソースコード
#include <bits/stdc++.h>#define all(r) r.begin(),r.end()using namespace std;typedef int64_t ll;struct Solution {void solve(std::istream& in, std::ostream& out) {string s, t;in >> s;sort(all(s));t = s;t.erase(unique(all(t)), t.end());int alpha[26] = {};for (int i = 0; i < 13; i++) {alpha[s[i] - 'a']++;}ll len = 0;for (int i = 0; i < 26; i++) {len += alpha[i] == 2;}if (len == 6) {string ans = "";for (int i = 0; i < 13; i++) {if (s[i] != t[i / 2]) {ans = t[i / 2];break;}}out << ans << '\n';}else {out << "Impossible" << '\n';}}};void solve(std::istream& in, std::ostream& out) {out << std::setprecision(12);Solution solution;solution.solve(in, out);}#include <fstream>#include <iostream>int main() {ios_base::sync_with_stdio(0);cin.tie(0);istream& in = cin;ostream& out = cout;solve(in, out);return 0;}