12275 | 2024-12-10 22:05:33 | Csongi | Felhasználónevek | cpp17 | Time limit exceeded 60/100 | 1.1s | 22328 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;
set<string> f;
for (int i = 0; i < n; i++)
{
cin >> x;
if (x == valerio)
{
t = true;
}
f.insert(x);
}
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 | 320 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 1ms | 336 KiB | ||||
4 | Accepted | 1ms | 344 KiB | ||||
subtask3 | 40/40 | ||||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 508 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 | 508 KiB | ||||
13 | Accepted | 1ms | 424 KiB | ||||
14 | Accepted | 1ms | 320 KiB | ||||
subtask4 | 0/40 | ||||||
15 | Accepted | 246ms | 22328 KiB | ||||
16 | Accepted | 407ms | 22264 KiB | ||||
17 | Accepted | 469ms | 22320 KiB | ||||
18 | Time limit exceeded | 1.1s | 22252 KiB | ||||
19 | Time limit exceeded | 1.082s | 22184 KiB | ||||
20 | Time limit exceeded | 1.085s | 22328 KiB | ||||
21 | Time limit exceeded | 1.088s | 22104 KiB | ||||
22 | Time limit exceeded | 1.087s | 22096 KiB | ||||
23 | Time limit exceeded | 1.088s | 15672 KiB | ||||
24 | Time limit exceeded | 1.082s | 15640 KiB | ||||
25 | Time limit exceeded | 1.088s | 15584 KiB | ||||
26 | Time limit exceeded | 1.085s | 15416 KiB | ||||
27 | Accepted | 230ms | 22328 KiB |