結果
| 問題 |
No.233 めぐるはめぐる (3)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-26 21:52:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 1,000 ms |
| コード長 | 1,459 bytes |
| コンパイル時間 | 3,106 ms |
| コンパイル使用メモリ | 188,072 KB |
| 実行使用メモリ | 8,572 KB |
| 最終ジャッジ日時 | 2024-09-19 00:10:23 |
| 合計ジャッジ時間 | 5,652 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/exception_ptr.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/exception:168,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:3:
In function 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = char]',
inlined from 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = char*; _ForwardIterator2 = char*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:182:11,
inlined from 'void std::__reverse(_RandomAccessIterator, _RandomAccessIterator, random_access_iterator_tag) [with _RandomAccessIterator = char*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algo.h:1107:18,
inlined from 'bool std::__next_permutation(_BidirectionalIterator, _BidirectionalIterator, _Compare) [with _BidirectionalIterator = char*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algo.h:2907:22,
inlined from 'bool std::next_permutation(_BIter, _BIter) [with _BIter = char*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algo.h:2947:2,
inlined from 'int main()' at main.cpp:56:30:
/
ソースコード
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include "bits/stdc++.h"
// #define _CRT_SECURE_NO_WARNINGS
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define ALL(a) begin(a), end(a)
#define let const auto
int scan() {
int result = 0;
while (true) {
auto k = getchar_unlocked();
if (k < '0' || k > '9') break;
result = 10 * result + k - '0';
}
return result;
}
char S[] = "aaeiuu";
char C[] = "bgmnr";
string SC = "aaeiuubgmnr";
auto used = unordered_set<size_t>();
bool check(const string& str) {
if (used.find(hash<string>()(str)) == used.end()) {
printf("%s\n", str.c_str());
return true;
}
return false;
}
char cache[] = "inabameguru";
signed main() {
let n = scan();
if (n == 129600) { // 最大値は計算で出せる
printf("NO\n");
return 0;
}
REP(_, n) {
REP(i, 11) cache[i] = getchar_unlocked();
used.insert(hash<string>()(cache));
getchar_unlocked();
};
do {
do {
SC[0] = S[0];
REP(i, 5) {
SC[i * 2 + 2] = S[i + 1];
SC[i * 2 + 1] = C[i];
}
REP(i, 5) {
if (check(SC)) return 0;
swap(SC[i * 2], SC[i * 2 + 1]);
}
if (check(SC)) return 0;
} while (next_permutation(begin(C), end(C) - 1));
} while (next_permutation(begin(S), end(S) - 1));
}