結果

問題 No.2671 NUPC Decompressor
ユーザー yansi819
提出日時 2024-03-16 09:14:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 209,308 KB
最終ジャッジ日時 2025-02-20 06:45:37
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int K;
char S[8] = {'N', '1', 'U', '1', 'P', '1', 'C', '1'};
string T;
queue<string> Q;
vector<string> vec;

int main(void){
  cin >> K;
  Q.push("");
  for (int i = 0; i < 8; i++) {
    queue<string> Q2;
    while (!Q.empty()) {
      T = Q.front(); Q.pop();
      if (i % 2 == 0) {
        Q2.push(T + S[i]);
      } else {
        for (int i = 1; i <= 2; i++) {
          if (i == 1) Q2.push(T);
          if (i == 2) Q2.push(T + T);
        }
      }
    }
    swap(Q, Q2);
  }
  while (!Q.empty()) {
    T = Q.front(); Q.pop();
    vec.push_back(T);
  }
  sort(vec.begin(), vec.end());
  cout << vec[K - 1] << endl;
  return 0;
}
0