結果

問題 No.701 ひとりしりとり
ユーザー ei1333333ei1333333
提出日時 2018-06-15 22:24:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 2,027 ms
コンパイル使用メモリ 203,780 KB
実行使用メモリ 36,108 KB
最終ジャッジ日時 2023-09-13 04:47:06
合計ジャッジ時間 4,815 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
35,756 KB
testcase_01 AC 130 ms
35,740 KB
testcase_02 AC 130 ms
35,812 KB
testcase_03 AC 130 ms
35,784 KB
testcase_04 AC 131 ms
35,832 KB
testcase_05 AC 131 ms
36,000 KB
testcase_06 AC 130 ms
35,784 KB
testcase_07 AC 131 ms
35,792 KB
testcase_08 AC 131 ms
35,872 KB
testcase_09 AC 133 ms
36,108 KB
testcase_10 AC 144 ms
35,852 KB
testcase_11 AC 254 ms
35,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  int N;
  cin >> N;
  vector< string > g[2][2];
  for(int i = 0; i < (1 << 19); i++) {
    string x;
    for(int j = 0; j < 19; j++) {
      if((i >> j) & 1) x += 'a';
      else x += 'b';
    }
    g[x.front() == 'b'][x.back() == 'b'].push_back(x);
  }
  int cur = 0;
  while(N > 0) {
    cout << g[cur][cur ^ 1].back();
    if(N == 1) cout << "n";
    cout << endl;
    g[cur][cur ^ 1].pop_back();
    cur ^= 1;
    --N;
  }
}
0