結果

問題 No.233 めぐるはめぐる (3)
ユーザー 👑 jupirojupiro
提出日時 2020-07-14 01:41:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 1,000 ms
コード長 1,951 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 140,744 KB
実行使用メモリ 13,704 KB
最終ジャッジ日時 2023-08-09 01:47:29
合計ジャッジ時間 5,619 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
13,584 KB
testcase_01 AC 133 ms
13,548 KB
testcase_02 AC 109 ms
13,600 KB
testcase_03 AC 134 ms
13,576 KB
testcase_04 AC 154 ms
13,572 KB
testcase_05 AC 155 ms
13,700 KB
testcase_06 AC 161 ms
13,564 KB
testcase_07 AC 156 ms
13,512 KB
testcase_08 AC 153 ms
13,704 KB
testcase_09 AC 76 ms
13,496 KB
testcase_10 AC 75 ms
13,564 KB
testcase_11 AC 76 ms
13,504 KB
testcase_12 AC 130 ms
13,512 KB
testcase_13 AC 154 ms
13,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

int main()
{
    
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<char> v, c;
    v = { 'a','a','i','u','u','e' };
    c = { 'n','b','m','g','r' };
    sort(v.begin(), v.end());
    sort(c.begin(), c.end());
    set<string> ss;
    do {
        do {
            string s1, s2;
            for (int i = 0; i < c.size(); i++) {
                s1 += c[i];
                s1 += v[i];
            }
            for (int i = 0; i <= s1.size(); i++) {
                s2 = s1;
                s2.insert(s2.begin() + i, v.back());
                ss.emplace(s2);
            }
        } while (next_permutation(c.begin(), c.end()));
    } while (next_permutation(v.begin(), v.end()));
    int n; cin >> n;
    for (int kkt = 0; kkt < n; kkt++) {
        string s; cin >> s;
        auto itr = ss.find(s);
        if (itr != ss.end()) ss.erase(itr);
    }
    if (!ss.empty()) cout << *ss.begin() << endl;
    else cout << "NO" << endl;
    return 0;
}
0