Submission #1607579


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

namespace {
    string s;
    void input() {
        cin >> s;
    }

    string& succ(string& x) {
        if (x.empty()) x.push_back('a');
        else if (x.back() == 'z') {
            x.pop_back();
            succ(x);
            x.push_back('a');
        } else {
            x.back()++;
        }
        return x;
    }

    bool includes(const string& s, const string& t) {
        int i = 0, j = 0;
        while (i < s.size() && j < t.size()) {
            if (s[i] == t[j]) j++;
            i++;
        }
        return j == t.size();
    }

    void solve() {
        string t = "a";
        while (true) {
            if (includes(s, t)) succ(t);
            else break;
        }
        cout << t << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}

Submission Info

Submission Time
Task E - Don't Be a Subsequence
User izuru
Language C++14 (GCC 5.4.1)
Score 0
Code Size 879 Byte
Status TLE
Exec Time 2103 ms
Memory 640 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 640 KB
11.txt TLE 2103 ms 640 KB
12.txt TLE 2103 ms 640 KB
13.txt TLE 2103 ms 640 KB
14.txt TLE 2103 ms 640 KB
15.txt TLE 2103 ms 640 KB
16.txt TLE 2103 ms 640 KB
17.txt TLE 2103 ms 640 KB
18.txt TLE 2103 ms 640 KB
19.txt TLE 2103 ms 640 KB
2.txt TLE 2103 ms 256 KB
20.txt TLE 2103 ms 640 KB
21.txt TLE 2103 ms 640 KB
22.txt TLE 2103 ms 640 KB
23.txt TLE 2103 ms 640 KB
24.txt TLE 2103 ms 640 KB
25.txt TLE 2103 ms 640 KB
26.txt TLE 2103 ms 640 KB
27.txt TLE 2103 ms 640 KB
28.txt TLE 2103 ms 640 KB
29.txt TLE 2103 ms 640 KB
3.txt TLE 2103 ms 256 KB
30.txt TLE 2103 ms 640 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 640 KB
8.txt TLE 2103 ms 640 KB
9.txt TLE 2103 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB