122732024-12-10 22:01:22CsongiFelhasználónevekcpp17Time limit exceeded 60/1001.1s12916 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    string valerio; cin >> valerio;
    int n, k = 1; bool t = false; cin >> n;
    string x;
    vector<string> f;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (x == valerio)
        {
            t = true;
        }
        f.push_back(x);
    }
    if (!t)
    {
        cout << valerio << endl; return 0;
    }
    sort(f.begin(), f.end());
    while (find(f.begin(), f.end(), valerio+to_string(k)) != f.end())
    {
        k++;
    }
    cout << valerio+to_string(k) << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms320 KiB
subtask220/20
3Accepted1ms320 KiB
4Accepted1ms320 KiB
subtask340/40
5Accepted1ms320 KiB
6Accepted1ms320 KiB
7Accepted1ms320 KiB
8Accepted1ms320 KiB
9Accepted1ms320 KiB
10Accepted1ms320 KiB
11Accepted1ms320 KiB
12Accepted1ms380 KiB
13Accepted1ms320 KiB
14Accepted1ms320 KiB
subtask40/40
15Accepted45ms12808 KiB
16Accepted140ms12804 KiB
17Accepted148ms12900 KiB
18Time limit exceeded1.1s12916 KiB
19Time limit exceeded1.088s12812 KiB
20Time limit exceeded1.085s12816 KiB
21Time limit exceeded1.1s12816 KiB
22Time limit exceeded1.088s12816 KiB
23Time limit exceeded1.088s9132 KiB
24Time limit exceeded1.08s9136 KiB
25Time limit exceeded1.1s9132 KiB
26Time limit exceeded1.082s8876 KiB
27Accepted48ms12812 KiB