結果

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

ソースコード

diff #

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

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
    if(vec.empty()) return os;
    os << vec[0];
    for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
    return os;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K;
    cin >> K;
    string s = "NUPC";
    vector<string> ans;
    for(int i = 0; i < 16; i++){
        string t;
        for(int j = 0; j < 4; j++){
            t += s[j];
            if(i >> j & 1) t += t; 
        }
        ans.push_back(t);
    }
    sort(ans.begin(), ans.end());
    cout << ans[K - 1] << '\n';
}
0