Submission #68461615
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>#include <string.h>int N, K, X;char S[12][12];int str_num = 0;char strs[114514][64];char cur_str[64];void meow(int pos) {if (pos >= K) {strcpy(strs[str_num++], cur_str);} else {char* p = cur_str + strlen(cur_str);int i;for (i = 0; i < N; i++) {strcpy(p, S[i]);meow(pos + 1);
#include <stdio.h> #include <stdlib.h> #include <string.h> int N, K, X; char S[12][12]; int str_num = 0; char strs[114514][64]; char cur_str[64]; void meow(int pos) { if (pos >= K) { strcpy(strs[str_num++], cur_str); } else { char* p = cur_str + strlen(cur_str); int i; for (i = 0; i < N; i++) { strcpy(p, S[i]); meow(pos + 1); } *p = '\0'; } } char* pstrs[114514]; int cmp(const void* x, const void* y) { return strcmp(*(const char**)x, *(const char**)y); } int main(void) { int i; if (scanf("%d%d%d", &N, &K, &X) != 3) return 1; for (i = 0; i < N; i++) { if (scanf("%11s", S[i]) != 1) return 1; } meow(0); for (i = 0; i < str_num; i++) { pstrs[i] = strs[i]; } qsort(pstrs, str_num, sizeof(*pstrs), cmp); puts(pstrs[X - 1]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Concat (X-th) |
User | mikecat |
Language | C (gcc 12.2.0) |
Score | 300 |
Code Size | 827 Byte |
Status | AC |
Exec Time | 18 ms |
Memory | 9192 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 1 ms | 1936 KiB |
hand_02.txt | AC | 18 ms | 9192 KiB |
hand_03.txt | AC | 1 ms | 1936 KiB |
hand_04.txt | AC | 16 ms | 9132 KiB |
hand_06.txt | AC | 1 ms | 1608 KiB |
hand_07.txt | AC | 1 ms | 1556 KiB |
random_01.txt | AC | 13 ms | 9164 KiB |
random_02.txt | AC | 8 ms | 6008 KiB |
random_03.txt | AC | 1 ms | 1640 KiB |
random_04.txt | AC | 1 ms | 1608 KiB |
random_05.txt | AC | 12 ms | 9084 KiB |
random_06.txt | AC | 0 ms | 1612 KiB |
random_07.txt | AC | 1 ms | 1524 KiB |
random_08.txt | AC | 1 ms | 1804 KiB |
random_09.txt | AC | 15 ms | 9180 KiB |
random_10.txt | AC | 1 ms | 2312 KiB |
random_11.txt | AC | 14 ms | 9128 KiB |
random_12.txt | AC | 2 ms | 2816 KiB |
random_13.txt | AC | 15 ms | 9172 KiB |
random_14.txt | AC | 1 ms | 1624 KiB |
random_15.txt | AC | 1 ms | 1592 KiB |
random_16.txt | AC | 1 ms | 1584 KiB |
random_17.txt | AC | 12 ms | 9132 KiB |
random_18.txt | AC | 9 ms | 8908 KiB |
random_19.txt | AC | 1 ms | 1624 KiB |
sample_01.txt | AC | 1 ms | 1616 KiB |
sample_02.txt | AC | 1 ms | 1756 KiB |