104192024-04-02 00:04:27111Felhasználónevekcpp17Wrong answer 20/100217ms23256 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{
				string zz=z.substr(S.size())+" 1";
				int y,yy;
				int x=sscanf(zz.data(),"%i %i",&y,&yy);
				if(x==2)s.insert(y);
			}
		}
	}
	int i=0;
	while(s.count(i)){
		i++;
	}
	if(i){
		S+=to_string(i);
	}
	cout<<S<<'\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1736 KiB
2Accepted3ms1968 KiB
subtask220/20
3Accepted3ms2092 KiB
4Accepted3ms2300 KiB
subtask30/40
5Accepted3ms2524 KiB
6Accepted3ms2724 KiB
7Accepted3ms2940 KiB
8Accepted3ms3132 KiB
9Accepted3ms3328 KiB
10Accepted3ms3544 KiB
11Accepted3ms3768 KiB
12Accepted3ms3852 KiB
13Wrong answer3ms3836 KiB
14Wrong answer3ms3972 KiB
subtask40/40
15Accepted187ms22800 KiB
16Accepted187ms22968 KiB
17Accepted188ms23056 KiB
18Accepted189ms23052 KiB
19Accepted210ms23148 KiB
20Accepted216ms23196 KiB
21Accepted217ms23256 KiB
22Accepted204ms23012 KiB
23Accepted61ms7208 KiB
24Accepted63ms7444 KiB
25Wrong answer64ms7124 KiB
26Wrong answer59ms7116 KiB
27Wrong answer201ms22996 KiB