結果

問題 No.2268 NGワード回避
ユーザー MarioYC
提出日時 2023-04-14 21:50:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 194,656 KB
最終ジャッジ日時 2025-02-12 06:34:39
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

bool have[1 << 10];

int main(){
    int N;
    cin >> N;
    string s;
    for(int i = 0;i < N;++i){
        cin >> s;
        int aux = 0;
        for(int j = 0;j < N && j < 10;++j){
            if(s[j] == 'b'){
                aux |= (1 << j);
            }
        }
        have[aux] = true;
    }
    int l = min(N, 10);
    for(int mask = 0;mask < (1 << l);++mask){
        if(!have[mask]){
            for(int j = 0;j < l;++j){
                if(mask >> j & 1) cout << 'b';
                else cout << 'a';
            }
            for(int j = l;j < N;++j){
                cout << 'a';
            }
            cout << endl;
            return 0;
        }
    }
    return 0;
}
0