10424 | 2024-04-02 00:23:38 | 111 | Felhasználónevek | cpp17 | Accepted 100/100 | 201ms | 35684 KiB |
#include <bits/stdc++.h>
using namespace std;
// #define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
string S;
cin>>S;
int N;
cin>>N;
vector<string>v(N);
int b=0;
for(int i=0;i<N;i++){
cin>>v[i];
if(v[i]==S)b=1;
}
if(!b){
cout<<S<<'\n';
return 0;
}
sort(v.begin(),v.end());
int i=1;
while(binary_search(v.begin(),v.end(),S+to_string(i))){
i++;
}
S+=to_string(i);
cout<<S<<'\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2104 KiB | ||||
2 | Accepted | 3ms | 2232 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 2360 KiB | ||||
4 | Accepted | 3ms | 2580 KiB | ||||
subtask3 | 40/40 | ||||||
5 | Accepted | 3ms | 2688 KiB | ||||
6 | Accepted | 3ms | 2904 KiB | ||||
7 | Accepted | 3ms | 2980 KiB | ||||
8 | Accepted | 3ms | 3100 KiB | ||||
9 | Accepted | 3ms | 3184 KiB | ||||
10 | Accepted | 3ms | 3408 KiB | ||||
11 | Accepted | 3ms | 3496 KiB | ||||
12 | Accepted | 3ms | 3536 KiB | ||||
13 | Accepted | 3ms | 3716 KiB | ||||
14 | Accepted | 3ms | 3940 KiB | ||||
subtask4 | 40/40 | ||||||
15 | Accepted | 43ms | 35000 KiB | ||||
16 | Accepted | 138ms | 35020 KiB | ||||
17 | Accepted | 137ms | 35004 KiB | ||||
18 | Accepted | 165ms | 35136 KiB | ||||
19 | Accepted | 196ms | 35452 KiB | ||||
20 | Accepted | 201ms | 35684 KiB | ||||
21 | Accepted | 200ms | 35392 KiB | ||||
22 | Accepted | 186ms | 35396 KiB | ||||
23 | Accepted | 97ms | 18112 KiB | ||||
24 | Accepted | 100ms | 18224 KiB | ||||
25 | Accepted | 97ms | 18000 KiB | ||||
26 | Accepted | 97ms | 18008 KiB | ||||
27 | Accepted | 43ms | 35628 KiB |