104182024-04-01 23:59:35111Felhasználónevekcpp17Runtime error 20/100187ms23456 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;
	set<int>s;
	for(int i=0;i<N;i++){
		string z;
		cin>>z;
		if(z.substr(0,S.size())==S){
			if(z.size()==S.size()){
				s.insert(0);
			}
			else{
				s.insert(stoi(z.substr(S.size())));
			}
		}
	}
	int i=0;
	while(s.count(i)){
		i++;
	}
	if(i){
		S+=to_string(i);
	}
	cout<<S<<'\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Accepted3ms2052 KiB
subtask220/20
3Accepted3ms2400 KiB
4Accepted3ms2648 KiB
subtask30/40
5Accepted3ms2744 KiB
6Accepted3ms2952 KiB
7Accepted3ms3040 KiB
8Accepted3ms3044 KiB
9Accepted3ms3132 KiB
10Accepted3ms3348 KiB
11Accepted3ms3352 KiB
12Accepted3ms3460 KiB
13Runtime error4ms4340 KiB
14Runtime error4ms4448 KiB
subtask40/40
15Accepted140ms22624 KiB
16Accepted148ms22876 KiB
17Accepted133ms22924 KiB
18Accepted157ms23024 KiB
19Accepted187ms22952 KiB
20Accepted157ms22940 KiB
21Accepted158ms22988 KiB
22Accepted171ms22980 KiB
23Runtime error4ms4660 KiB
24Runtime error4ms4684 KiB
25Runtime error4ms4812 KiB
26Runtime error4ms4712 KiB
27Wrong answer158ms23456 KiB