12281 | 2024-12-10 22:14:42 | Csongi | Felhasználónevek | cpp17 | Accepted 100/100 | 239ms | 16088 KiB |
#include <bits/stdc++.h>
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;
vector<string> f(n);
for (int i = 0; i < n; i++)
{
cin >> f[i];
if (f[i] == valerio)
{
t = true;
}
}
if (!t)
{
cout << valerio << endl; return 0;
}
sort(f.begin(), f.end());
while (binary_search(f.begin(), f.end(), valerio+to_string(k)))
{
k++;
}
cout << valerio+to_string(k) << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 500 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 1ms | 320 KiB | ||||
4 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 40/40 | ||||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 320 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 320 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Accepted | 1ms | 508 KiB | ||||
12 | Accepted | 1ms | 320 KiB | ||||
13 | Accepted | 1ms | 320 KiB | ||||
14 | Accepted | 1ms | 320 KiB | ||||
subtask4 | 40/40 | ||||||
15 | Accepted | 43ms | 15964 KiB | ||||
16 | Accepted | 170ms | 16068 KiB | ||||
17 | Accepted | 143ms | 16000 KiB | ||||
18 | Accepted | 170ms | 15928 KiB | ||||
19 | Accepted | 239ms | 15928 KiB | ||||
20 | Accepted | 210ms | 15928 KiB | ||||
21 | Accepted | 211ms | 15904 KiB | ||||
22 | Accepted | 211ms | 16088 KiB | ||||
23 | Accepted | 109ms | 7288 KiB | ||||
24 | Accepted | 108ms | 7204 KiB | ||||
25 | Accepted | 108ms | 7116 KiB | ||||
26 | Accepted | 105ms | 6968 KiB | ||||
27 | Accepted | 46ms | 15928 KiB |