Submission #2498638
Source Code Expand
/* --- author: dxm --- */ #include<bits/stdc++.h> using namespace std; #define INF 1e9 #define Inf 1e18 #define rep(i,n) for(int (i)=0;(i)<n;i++) #define REP(i,n) for(int (i)=1;(i)<=n;i++) #define mp make_pair #define pb push_back #define pii pair<int,int> #define fst first #define snd second typedef long long ll; inline void Fail(){printf("0");exit(0);} const int maxn=5005; int n,k; char c[maxn]; string s; vector<string>ans; int main(){ scanf("%s%d",c,&k);s=c;n=s.size(); rep(i,n)for(int j=i;j<n;j++){ if(j-i+1>=10)continue; ans.pb(s.substr(i,j-i+1)); } sort(ans.begin(),ans.end()); ans.resize(unique(ans.begin(),ans.end())-ans.begin()); printf("%s",ans[k-1].c_str()); return 0; } /* Input: ----------------- Output: */
Submission Info
Submission Time | |
---|---|
Task | C - K-th Substring |
User | little_waxberry |
Language | C++ (GCC 5.4.1) |
Score | 300 |
Code Size | 777 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 2680 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:24:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s%d",c,&k);s=c;n=s.size(); ^
Judge Result
Set Name | Sample | Subtask | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
Subtask | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 2_011.txt, 2_012.txt, 2_013.txt, 2_014.txt, 2_015.txt, 2_016.txt, 2_017.txt, 2_018.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 1 ms | 256 KB |
1_004.txt | AC | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | AC | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 1 ms | 256 KB |
1_009.txt | AC | 1 ms | 256 KB |
1_010.txt | AC | 1 ms | 256 KB |
2_011.txt | AC | 24 ms | 2680 KB |
2_012.txt | AC | 24 ms | 2680 KB |
2_013.txt | AC | 26 ms | 2424 KB |
2_014.txt | AC | 29 ms | 2680 KB |
2_015.txt | AC | 21 ms | 2300 KB |
2_016.txt | AC | 30 ms | 2680 KB |
2_017.txt | AC | 30 ms | 2680 KB |
2_018.txt | AC | 29 ms | 2680 KB |