Submission #2495110
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
before_main_function() {
cin.tie(0);ios::sync_with_stdio(false);
cout<<setprecision(15)<<fixed;
#define endl "\n"
}
} before_main_function;
//------------------8<------------------------------------8<--------------------
signed main() {
string s;
cin >> s;
int k;
cin >> k;
set<string> se;
int n = SZ(s);
REP(i, n) {
REP(j, n - i + 1) {
if (s.substr(i, j) != "") se.insert(s.substr(i, j));
}
}
auto itr = begin(se);
REP(i, k - 1) itr++;
cout << *itr << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - K-th Substring |
User |
algon |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
1991 Byte |
Status |
TLE |
Exec Time |
2203 ms |
Memory |
1672448 KB |
Judge Result
Set Name |
Sample |
Subtask |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
0 / 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 |
2 ms |
256 KB |
0_002.txt |
AC |
2 ms |
256 KB |
1_003.txt |
AC |
1 ms |
256 KB |
1_004.txt |
AC |
2 ms |
256 KB |
1_005.txt |
AC |
2 ms |
256 KB |
1_006.txt |
AC |
2 ms |
256 KB |
1_007.txt |
AC |
2 ms |
256 KB |
1_008.txt |
AC |
2 ms |
384 KB |
1_009.txt |
AC |
2 ms |
256 KB |
1_010.txt |
AC |
2 ms |
384 KB |
2_011.txt |
TLE |
2104 ms |
16256 KB |
2_012.txt |
TLE |
2104 ms |
21504 KB |
2_013.txt |
TLE |
2190 ms |
1462016 KB |
2_014.txt |
TLE |
2198 ms |
1571456 KB |
2_015.txt |
TLE |
2185 ms |
1396608 KB |
2_016.txt |
TLE |
2202 ms |
1639552 KB |
2_017.txt |
TLE |
2203 ms |
1672448 KB |
2_018.txt |
TLE |
2202 ms |
1650048 KB |