Submission #67922003


Source Code Expand

// @yuuzaa_tkms
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, a, b) for(ll i = a; i < (ll)(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YeNo(a) cout<<((a)?"Yes":"No")<<endl;
#define YENO(a) cout<<((a)?"YES":"NO")<<endl;
#define Ye cout<<"Yes"<<endl
#define YE cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Vcin(a) rep(i,a.size())cin>>a[i];
#define println(n) cout<<n<<endl
#define printsp(n) cout<<n<<" "
#define print(n) cout<<n
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define vec vector
#define fin do{return 0;}while(0)
using namespace std;
using ll=long long;
using ull=unsigned long long;
vector<int>dx={0,1,0,-1,-1,-1,1,1};
vector<int>dy={1,0,-1,0,-1,1,-1,1};
ll LINF=1e18;
int INF=1e9;
bool edge(int x,int y,int H,int W){
    if(x<0||x>=H||y<0||y>=W)return 0;
    else return 1;
}

//実装は丁寧に書こう
//考察は文章化してみる
//その条件分岐は正しいですか?
//わからないときは答えの二分探索,ナップザックDP,遅延セグ木,平方分割
//1400復帰しよう!
int N,K;
vec<string>U;
vec<string>S;
string T;
void dfs(int i){
    if(i==K){
        U.pb(T);
        return;
    }
    rep(j,N){
        string V=T;
        T+=S[j];

        dfs(i+1);
        T=V;
    }
    return;
}
int main(){
    int X;
    cin>>N>>K>>X;
    S.resize(N);
    rep(i,N){
        cin>>S[i];
    }
    dfs(0);
    sort(all(U));
    println(U[X-1]);
}

Submission Info

Submission Time
Task C - Concat (X-th)
User tkms
Language C++ 20 (gcc 12.2)
Score 300
Code Size 1628 Byte
Status AC
Exec Time 24 ms
Memory 12600 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 27
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_06.txt, hand_07.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 2 ms 3620 KiB
hand_02.txt AC 24 ms 10384 KiB
hand_03.txt AC 1 ms 3800 KiB
hand_04.txt AC 23 ms 9092 KiB
hand_06.txt AC 1 ms 3512 KiB
hand_07.txt AC 1 ms 3528 KiB
random_01.txt AC 21 ms 9708 KiB
random_02.txt AC 14 ms 7916 KiB
random_03.txt AC 1 ms 3596 KiB
random_04.txt AC 1 ms 3492 KiB
random_05.txt AC 22 ms 10300 KiB
random_06.txt AC 1 ms 3592 KiB
random_07.txt AC 1 ms 3504 KiB
random_08.txt AC 2 ms 3632 KiB
random_09.txt AC 22 ms 11000 KiB
random_10.txt AC 2 ms 3660 KiB
random_11.txt AC 22 ms 9284 KiB
random_12.txt AC 4 ms 4588 KiB
random_13.txt AC 23 ms 11024 KiB
random_14.txt AC 1 ms 3548 KiB
random_15.txt AC 1 ms 3464 KiB
random_16.txt AC 1 ms 3540 KiB
random_17.txt AC 24 ms 12600 KiB
random_18.txt AC 18 ms 12544 KiB
random_19.txt AC 1 ms 3496 KiB
sample_01.txt AC 1 ms 3472 KiB
sample_02.txt AC 2 ms 3624 KiB