結果
| 問題 |
No.2671 NUPC Decompressor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-09 00:12:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 911 bytes |
| コンパイル時間 | 2,056 ms |
| コンパイル使用メモリ | 205,908 KB |
| 最終ジャッジ日時 | 2025-02-20 03:18:28 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
string decompress(string s) {
string res = "";
for (auto&& c : s) {
if ('A' <= c && c <= 'Z') {
res.push_back(c);
} else {
if (c == '2') {
res = res + res;
}
}
}
return res;
}
int main() {
int K;
cin >> K;
const int size = 4;
vector<string> compressed;
for (int bit = 0; bit < (1 << size); bit++) {
string tmp = "N1U1P1C1";
for (int i = 0; i < size; i++) {
if (bit & (1 << i)) {
tmp[2 * i + 1] = '2';
}
}
compressed.push_back(tmp);
}
vector<string> decompressed;
for (auto&& s : compressed) {
string t = decompress(s);
decompressed.push_back(t);
}
sort(decompressed.begin(), decompressed.end());
cout << decompressed[K - 1] << endl;
}