結果

問題 No.2268 NGワード回避
ユーザー NAMIDAIRONAMIDAIRO
提出日時 2023-04-14 23:30:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 3,507 bytes
コンパイル時間 1,233 ms
コンパイル使用メモリ 122,012 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 21:13:55
合計ジャッジ時間 3,229 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 AC 1 ms
5,376 KB
testcase_46 AC 2 ms
5,376 KB
testcase_47 AC 18 ms
5,376 KB
testcase_48 AC 18 ms
5,376 KB
testcase_49 AC 18 ms
5,376 KB
testcase_50 AC 18 ms
5,376 KB
testcase_51 AC 19 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <random>
#include <iomanip>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)

template<class T>
using vi = vector<T>;

template<class T>
using vii = vector<vi<T>>;

template<class T>
using viii = vector<vii<T>>;

using P = pair<ll, int>;

void chmin(ll & x, ll y) { x = min(x, y); }


template<class T>
struct FFT {
    const double pi = acos(-1);
    const int mx = 30;
    vector<complex<long double>> zeta, invzeta;

    FFT() : zeta(mx), invzeta(mx) {
        int n = 1;
        for (int i = 0; i < mx; i++) {
            zeta[i] = polar(1.0, 2 * pi / n);
            n <<= 1;
        }
        n = 1;
        for (int i = 0; i < mx; i++) {
            invzeta[i] = polar(1.0, -2 * pi / n);
            n <<= 1;
        }
    }

    void dft(vector<complex<long double>>& d, const int log, const int inv = false) {
        int n = (int)d.size();
        if (n == 1 || log == 0) return;

        vector<complex<long double>> d0, d1;
        for (int i = 0; i < n / 2; i++) {
            d0.push_back(d[2 * i]);
            d1.push_back(d[2 * i + 1]);
        }
        dft(d0, log - 1, inv);
        dft(d1, log - 1, inv);
        complex<long double> pow = 1, z = (inv ? invzeta[log] : zeta[log]);

        for (int i = 0; i < n / 2; i++) {
            d[i] = d0[i] + pow * d1[i];
            pow *= z;
        }

        for (int i = n / 2; i < n; i++) {
            d[i] = d0[i - n / 2] + pow * d1[i - n / 2];
            pow *= z;
        }
        return;
    }

    void idft(vector<complex<long double>>& d, const int log) {
        dft(d, log, true);
        return;
    }

    vector<long double>  convolution(vector<T>& f, vector<T>& g) {
        int n = 1, log = 0, lenf = (int)f.size(), leng = (int)g.size();
        while (n < lenf + leng) {
            n <<= 1;
            log++;
        }

        vector<complex<long double>> df(n), dg(n);
        for (int i = 0; i < lenf; i++) df[i] = f[i];
        for (int i = 0; i < leng; i++) dg[i] = g[i];

        dft(df, log);
        dft(dg, log);
        for (int i = 0; i < n; i++) df[i] *= dg[i];
        idft(df, log);

        vector<long double> res(n);
        for (int i = 0; i < n; i++) res[i] = df[i].real() / n;
        return res;
    }
};

int main()
{
    int n;
    cin >> n;
    set<string> st;
    int mn = min(n, 15);
    rep(i, n) {
        string s;
        cin >> s;
        st.insert(s.substr(0, mn));
    }

    
    rep(bit, 1 << mn) {
        string s;
        rep(i, mn) {
            if (bit >> i & 1) s.push_back('a');
            else s.push_back('b');
        }
        if (st.count(s)) continue;
        cout << s;
        for (int i = mn; i < n; i++) cout << 'a';
        cout << endl;
        return 0;
    }


    return 0;

    /*int n;
    cin >> n;
    vii <bool> check(n, vi<bool>(n));
    rep(i, n) check[i][i] = true;

    int m;
    cin >> m;
    while (m--) {
        string s;
        cin >> s;
        vi<int> d0, d1;
        rep(i, n) {
            if (s[i] == '0') d0.push_back(i);
            else d1.push_back(i);
        }

        for (int e0 : d0) for (int e1 : d1) {
            check[e0][e1] = true;
            check[e1][e0] = true;
        }
    }

    bool ok = true;
    rep(i, n) rep(j, i) if (!check[i][j]) ok = false;
    cout << (ok ? "Yes" : "No") << endl;

	return 0;*/
}
0