Submission #67945442


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int N=3e5+10;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
map<int,int> mp;
int n,m,k;
int a[N],b[N];
void slove(){
    cin>>n>>k>>m;
    vector<string> s(n);
    for(int i=0;i<n;i++) cin>>s[i];
    vector<string> ans;
    auto dfs=[&](auto &&self,string ss,int x)->void{
        if(x==k){
            ans.push_back(ss);
            return;
        }
        for(int i=0;i<n;i++){
            self(self,ss+s[i],x+1);
        }
    };
    for(int i=0;i<n;i++){
        dfs(dfs,s[i],1);
    }
    sort(ans.begin(),ans.end());
    cout<<ans[m-1]<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
    int T=1;
    // cin>>T;
    while(T--){
        slove();
    }
}

Submission Info

Submission Time
Task C - Concat (X-th)
User Maikan
Language C++ 20 (gcc 12.2)
Score 300
Code Size 802 Byte
Status AC
Exec Time 27 ms
Memory 12672 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 3516 KiB
hand_02.txt AC 27 ms 10312 KiB
hand_03.txt AC 2 ms 3500 KiB
hand_04.txt AC 24 ms 9080 KiB
hand_06.txt AC 1 ms 3520 KiB
hand_07.txt AC 1 ms 3516 KiB
random_01.txt AC 23 ms 9848 KiB
random_02.txt AC 15 ms 7868 KiB
random_03.txt AC 1 ms 3568 KiB
random_04.txt AC 1 ms 3520 KiB
random_05.txt AC 24 ms 10364 KiB
random_06.txt AC 1 ms 3436 KiB
random_07.txt AC 1 ms 3448 KiB
random_08.txt AC 1 ms 3536 KiB
random_09.txt AC 23 ms 10864 KiB
random_10.txt AC 2 ms 3584 KiB
random_11.txt AC 23 ms 9276 KiB
random_12.txt AC 5 ms 4664 KiB
random_13.txt AC 23 ms 10920 KiB
random_14.txt AC 1 ms 3528 KiB
random_15.txt AC 1 ms 3508 KiB
random_16.txt AC 1 ms 3472 KiB
random_17.txt AC 25 ms 12472 KiB
random_18.txt AC 19 ms 12672 KiB
random_19.txt AC 1 ms 3564 KiB
sample_01.txt AC 1 ms 3376 KiB
sample_02.txt AC 1 ms 3648 KiB