12270 | 2024-12-10 21:30:43 | Csongi | Felhasználónevek | cpp17 | Wrong answer 20/100 | 68ms | 2624 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());
size_t pos = x.size();
while (pos > 0 && isdigit(x[pos - 1]))
{
pos--;
}
string szamresz = x.substr(pos);
if (!szamresz.empty())
{
f.push_back(stoi(szamresz));
}
}
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 | 500 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 340 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Accepted | 1ms | 320 KiB | ||||
12 | Accepted | 1ms | 320 KiB | ||||
13 | Wrong answer | 1ms | 320 KiB | ||||
14 | Wrong answer | 1ms | 320 KiB | ||||
subtask4 | 0/40 | ||||||
15 | Accepted | 65ms | 2396 KiB | ||||
16 | Accepted | 67ms | 2480 KiB | ||||
17 | Accepted | 68ms | 2532 KiB | ||||
18 | Accepted | 68ms | 2624 KiB | ||||
19 | Accepted | 67ms | 2488 KiB | ||||
20 | Accepted | 67ms | 2488 KiB | ||||
21 | Accepted | 68ms | 2592 KiB | ||||
22 | Accepted | 65ms | 2480 KiB | ||||
23 | Wrong answer | 46ms | 1460 KiB | ||||
24 | Wrong answer | 48ms | 1600 KiB | ||||
25 | Wrong answer | 46ms | 1460 KiB | ||||
26 | Wrong answer | 46ms | 1456 KiB | ||||
27 | Accepted | 65ms | 2480 KiB |