Submission #1980782


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

string str, sub;

static bool ok(string &a, string &b) {
	int i, j;
	for (i = 0, j = 0; i < a.size() && j < b.size(); ++i) {
		if (a[i] == b[j])
			++j; }
	return (j != b.size()); }

int main() {
#ifdef HOME
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	bool flag;
	int tmp;

	cin >> str;
	for (int i = 0; ; ++i) {
		tmp = i;
		flag = true;
		sub.clear();
		do { 
			sub.push_back(tmp % 27 + 'a' - 1);
			flag&= sub.back() != '`';
			tmp/= 27; }
		while (tmp > 0);

		reverse(begin(sub), end(sub));
		if (flag && ok(str, sub))
			break; }

	cout << sub << endl;

	return 0; }

Submission Info

Submission Time
Task E - Don't Be a Subsequence
User anai
Language C++14 (GCC 5.4.1)
Score 0
Code Size 749 Byte
Status TLE
Exec Time 2107 ms
Memory 720 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 3
AC × 7
TLE × 29
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 30.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 1 ms 256 KB
10.txt TLE 2103 ms 720 KB
11.txt TLE 2103 ms 720 KB
12.txt TLE 2103 ms 720 KB
13.txt TLE 2103 ms 720 KB
14.txt TLE 2103 ms 720 KB
15.txt TLE 2103 ms 720 KB
16.txt TLE 2103 ms 720 KB
17.txt TLE 2103 ms 720 KB
18.txt TLE 2103 ms 720 KB
19.txt TLE 2103 ms 720 KB
2.txt TLE 2103 ms 256 KB
20.txt TLE 2103 ms 720 KB
21.txt TLE 2103 ms 720 KB
22.txt TLE 2103 ms 720 KB
23.txt TLE 2107 ms 720 KB
24.txt TLE 2103 ms 720 KB
25.txt TLE 2103 ms 720 KB
26.txt TLE 2103 ms 720 KB
27.txt TLE 2103 ms 720 KB
28.txt TLE 2103 ms 720 KB
29.txt TLE 2103 ms 720 KB
3.txt TLE 2103 ms 256 KB
30.txt TLE 2103 ms 720 KB
4.txt TLE 2103 ms 256 KB
5.txt TLE 2103 ms 512 KB
6.txt TLE 2103 ms 512 KB
7.txt TLE 2103 ms 720 KB
8.txt TLE 2103 ms 720 KB
9.txt TLE 2103 ms 720 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB