結果

問題 No.233 めぐるはめぐる (3)
ユーザー むらためむらため
提出日時 2019-01-26 21:24:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,371 bytes
コンパイル時間 2,706 ms
コンパイル使用メモリ 188,088 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-18 23:11:58
合計ジャッジ時間 6,695 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:57:30:
/

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include "bits/stdc++.h"

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";
char SC[] = "aaeiuubgmnr";
// struct eq {bool operator()(){}};
auto used = unordered_set<char*>();
bool check() {
  if (used.find(SC) == used.end()) {
    printf("%s\n", SC);
    return true;
  }
  return false;
}
signed main() {
  let n = scan();
  if (n == 129600) {  // 最大値は計算で出せる
    printf("NO\n");
    return 0;
  }
  char cache[] = "inabameguru";
  REP(_, n) {
    REP(i, 11) cache[i] = getchar_unlocked();
    used.insert(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()) return 0;
        swap(SC[i * 2], SC[i * 2 + 1]);
      }
      if (check()) return 0;
    } while (next_permutation(ALL(C)));
  } while (next_permutation(ALL(S)));
}
0