結果

問題 No.233 めぐるはめぐる (3)
ユーザー むらためむらため
提出日時 2019-01-26 20:43:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,312 bytes
コンパイル時間 5,943 ms
コンパイル使用メモリ 224,476 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-10-19 01:50:47
合計ジャッジ時間 9,830 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 21 ms
6,208 KB
testcase_02 AC 13 ms
4,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 5 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 5 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
}
string S = "aabegimnruu";
auto used = unordered_set<string>();
#define is_consonant(c) \
  (c == 'n' || c == 'b' || c == 'm' || c == 'g' || c == 'r')
bool impl() {
  if (is_consonant(S[10])) return false;
  REP(i, 11) {
    if (is_consonant(S[i]) && is_consonant(S[i - 1])) return false;
  }
  if (used.find(S) == used.end()) {
    printf("%s\n", S.c_str());
    return true;
  }
  return false;
}
char cache[100] = {};
signed main() {
  let n = scan();
  if (n == 129600) {  // 最大値は計算で出せる
    printf("NO\n");
    return 0;
  }
  // string cache = "inabameguru";
  REP(_, n) {
    fgets(cache, 11, stdin);
    // REP(i, 11) cache[i] = getchar_unlocked();
    used.insert(cache);
    // getchar_unlocked();
  };
  do
    if (impl()) return 0;
  while (next_permutation(ALL(S)));
}
0