結果
問題 | No.2671 NUPC Decompressor |
ユーザー |
|
提出日時 | 2025-03-20 19:48:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,193 bytes |
コンパイル時間 | 2,239 ms |
コンパイル使用メモリ | 205,516 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-20 19:48:59 |
合計ジャッジ時間 | 3,345 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename Ostream, typename Cont> typename enable_if<is_same<Ostream, ostream>::value, Ostream&>::type operator<<(Ostream& os, const Cont& v){ os << "[ "; for(auto &x : v) os << x << ' '; return os << "]"; } template<typename Ostream, typename ...Ts> Ostream& operator << (Ostream &os, const pair<Ts...> &p){ return os << "{" << p.first << ", " << p.second << "}"; } void dbg_cerr() { cerr << "\e[0m\n"; } template<typename Head, typename... Tail> void dbg_cerr(Head H, Tail... T) { cerr << ' ' << H; dbg_cerr(T...); } #ifdef LTF #define DEBUG(...) cerr << "\e[1;31m[" #__VA_ARGS__ "]:", dbg_cerr(__VA_ARGS__) #else #define DEBUG(...) #endif void Solve() { int K; cin >> K; vector<string> s; string nupc = "NUPC"; constexpr int kC = 4; for (int mask = 0; mask < (1 << kC); mask++) { string cur = ""; for (int i = 0; i < kC; i++) { cur.push_back(nupc[i]); if (mask >> i & 1) cur += cur; } s.push_back(cur); } sort(s.begin(), s.end()); cout << s[K - 1] << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T = 1; // cin >> T; while (T--) { Solve(); } return 0; }