Submission #1627357
Source Code Expand
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;
string debug_show(P a) {
return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string s;
ll K;
cin >> s >> K;
int N = s.length();
int cur = 0;
vector<stack<int>> place(26);
rep(i, N) {
place[s[N - 1 - i] - 'a'].push(i);
}
string ans = "";
while (K > 0) {
K--;
int next = 0;
rep(i, 26) {
if (place[i].empty())continue;
if (place[i].top() > 63 || K - (1LL << place[i].top()) < 0) {
next = N - 1 - place[i].top() + 1;
ans += (char)('a' + i);
break;
}
K -= (1LL << place[i].top());
}
while (cur < next) {
place[s[cur] - 'a'].pop();
cur++;
}
}
if (ans.size() == 0) {
cout << "Eel" << endl;
}
else {
cout << ans << endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
G - 辞書順 |
User |
furuya1223 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
2207 Byte |
Status |
WA |
Exec Time |
11 ms |
Memory |
5532 KB |
Judge Result
Set Name |
All |
Score / Max Score |
0 / 4 |
Status |
|
Set Name |
Test Cases |
All |
00, 01, 02, 90, 91 |
Case Name |
Status |
Exec Time |
Memory |
00 |
WA |
11 ms |
5532 KB |
01 |
WA |
1 ms |
384 KB |
02 |
WA |
1 ms |
256 KB |
90 |
AC |
1 ms |
256 KB |
91 |
AC |
1 ms |
256 KB |