12268 | 2024-12-10 21:23:35 | Csongi | Felhasználónevek | cpp17 | Runtime error 20/100 | 64ms | 2584 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;
ll n; cin >> n;
string x;
vector<ll> f(0);
bool found = false;
for (ll i = 0; i < n; i++)
{
cin >> x;
if (x.find(valerio) != string::npos && x.length() > valerio.length())
{
x.erase(x.find(valerio), valerio.length());
f.push_back(stoi(x));
}
else if (x == valerio)
{
found = true;
f.push_back(0);
}
}
sort(f.begin(), f.end());
ll i = 0;
for (i = 0; i < f.size(); i++)
{
if (i != f[i] && found)
{
cout << valerio << i << endl;
return 0;
}
else if (!found)
{
cout << valerio << endl;
return 0;
}
}
cout << valerio << i << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 508 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 1ms | 320 KiB | ||||
4 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 0/40 | ||||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 520 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 320 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Accepted | 1ms | 320 KiB | ||||
12 | Accepted | 1ms | 384 KiB | ||||
13 | Runtime error | 3ms | 320 KiB | ||||
14 | Runtime error | 3ms | 320 KiB | ||||
subtask4 | 0/40 | ||||||
15 | Accepted | 63ms | 2480 KiB | ||||
16 | Accepted | 63ms | 2472 KiB | ||||
17 | Accepted | 63ms | 2488 KiB | ||||
18 | Accepted | 63ms | 2476 KiB | ||||
19 | Accepted | 64ms | 2488 KiB | ||||
20 | Accepted | 63ms | 2584 KiB | ||||
21 | Accepted | 64ms | 2400 KiB | ||||
22 | Accepted | 63ms | 2480 KiB | ||||
23 | Runtime error | 3ms | 568 KiB | ||||
24 | Runtime error | 3ms | 512 KiB | ||||
25 | Runtime error | 3ms | 320 KiB | ||||
26 | Runtime error | 3ms | 320 KiB | ||||
27 | Accepted | 63ms | 2416 KiB |