結果

問題 No.701 ひとりしりとり
ユーザー outlineoutline
提出日時 2021-01-06 17:27:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,759 bytes
コンパイル時間 1,526 ms
コンパイル使用メモリ 138,872 KB
実行使用メモリ 167,288 KB
最終ジャッジ日時 2024-04-24 18:01:10
合計ジャッジ時間 8,320 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<string> aa, ab, ba, bb;
    for(int mask = 0; mask < 1 << 20; ++mask){
        string s = "";
        for(int i = 0; i < 20; ++i){
            s += (mask >> i & 1) + 'a';
        }
        if(s[0] == 'a'){
            if(s[19] == 'a')    aa.emplace_back(s);
            else    ab.emplace_back(s);
        }
        else{
            if(s[19] == 'a')    ba.emplace_back(s);
            else    bb.emplace_back(s);
        }
    }
    vector<string> ans = bb;
    ans.emplace_back(ba[0]);
    for(int i = 0; i < (int)ab.size(); ++i){
        ans.emplace_back(ba[i]);
        ans.emplace_back(ab[i]);
    }
    copy(aa.begin(), aa.end(), back_inserter(ans));
    for(int i = 0; i < n; ++i)  cout << ans[i] << '\n';

    return 0;
}
0