結果
問題 | No.233 めぐるはめぐる (3) |
ユーザー | むらため |
提出日時 | 2019-01-26 20:27:22 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 182 ms / 1,000 ms |
コード長 | 1,309 bytes |
コンパイル時間 | 3,303 ms |
コンパイル使用メモリ | 226,288 KB |
実行使用メモリ | 12,728 KB |
最終ジャッジ日時 | 2023-10-18 23:13:03 |
合計ジャッジ時間 | 6,307 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
12,464 KB |
testcase_01 | AC | 24 ms
9,080 KB |
testcase_02 | AC | 13 ms
6,196 KB |
testcase_03 | AC | 31 ms
10,664 KB |
testcase_04 | AC | 182 ms
12,728 KB |
testcase_05 | AC | 96 ms
12,728 KB |
testcase_06 | AC | 93 ms
12,728 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 1 ms
4,348 KB |
testcase_09 | AC | 4 ms
4,348 KB |
testcase_10 | AC | 4 ms
4,348 KB |
testcase_11 | AC | 4 ms
4,348 KB |
testcase_12 | AC | 25 ms
9,080 KB |
testcase_13 | AC | 41 ms
12,728 KB |
ソースコード
#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; } bool is_consonant(char c) { const auto consonant = "nbmgr"; REP(i, 5) if (c == consonant[i]) return true; return false; } signed main() { let n = scan(); if (n == 129600) { // 最大値は計算で出せる printf("NO\n"); return 0; } auto used = unordered_set<string>(); string cache = "inabameguru"; REP(_, n) { REP(i, 11) cache[i] = getchar_unlocked(); used.insert(cache); getchar_unlocked(); }; string S = "aabegimnruu"; do { auto ok = true; if (is_consonant(S[10])) continue; REP(i, 11) { if (is_consonant(S[i]) && is_consonant(S[i - 1])) { ok = false; break; } } if (ok && used.find(S) == used.end()) { printf("%s\n", S.c_str()); return 0; } } while (next_permutation(ALL(S))); }