結果
問題 |
No.2671 NUPC Decompressor
|
ユーザー |
|
提出日時 | 2024-03-13 20:53:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,222 bytes |
コンパイル時間 | 2,174 ms |
コンパイル使用メモリ | 204,800 KB |
最終ジャッジ日時 | 2025-02-20 04:13:29 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; string decommpress(string s) { string res = ""; set<char> nupc = {'N', 'U', 'P', 'C'}; set<char> one_or_two = {'1', '2'}; for (auto&& c : s) { if (nupc.count(c)) { res.push_back(c); } else if (one_or_two.count(c)) { if (c == '2') res += res; } else { assert(false); } } return res; } int main() { int K; cin >> K; vector<string> compressed = { "N1U1P1C1", // 0 "N2U1P1C1", // 1 "N1U2P1C1", // 2 "N2U2P1C1", // 3 "N1U1P2C1", // 4 "N2U1P2C1", // 5 "N1U2P2C1", // 6 "N2U2P2C1", // 7 "N1U1P1C2", // 8 "N2U1P1C2", // 9 "N1U2P1C2", // 10 "N2U2P1C2", // 11 "N1U1P2C2", // 12 "N2U1P2C2", // 13 "N1U2P2C2", // 14 "N2U2P2C2", // 15 }; vector<string> decompressed; for (auto t : compressed) { string t_decompressed = decommpress(t); decompressed.push_back(t_decompressed); } // ソートをしない // sort(decompressed.begin(), decompressed.end()); cout << decompressed[K - 1] << endl; }