#include <cstdio>
#include <set>
int arr[50505];
int main()
{
int n, m;
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
{
scanf("%d", &arr[i]);
}
scanf("%d", &m);
if (m <= n)
{
printf("%d", arr[m]);
}
else
{
std::set<int> nSet;
for (int i = 1; i <= n; ++i)
{
nSet.insert(arr[i]);
}
for (int i = n + 1; i < m; ++i)
{
if (nSet.find(nSet.size()) != nSet.end())
break;
nSet.insert(nSet.size());
}
printf("%d", nSet.size());
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1412 KB |
Output is correct |
2 |
Correct |
0 ms |
1412 KB |
Output is correct |
3 |
Correct |
0 ms |
1412 KB |
Output is correct |
4 |
Correct |
0 ms |
1412 KB |
Output is correct |
5 |
Correct |
0 ms |
1412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1412 KB |
Output is correct |
2 |
Correct |
0 ms |
1412 KB |
Output is correct |
3 |
Correct |
0 ms |
1412 KB |
Output is correct |
4 |
Correct |
0 ms |
1412 KB |
Output is correct |
5 |
Correct |
0 ms |
1412 KB |
Output is correct |
6 |
Correct |
0 ms |
1412 KB |
Output is correct |
7 |
Correct |
0 ms |
1412 KB |
Output is correct |
8 |
Correct |
0 ms |
1412 KB |
Output is correct |
9 |
Correct |
0 ms |
1412 KB |
Output is correct |
10 |
Correct |
0 ms |
1412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
4976 KB |
Output is correct |
2 |
Correct |
0 ms |
1676 KB |
Output is correct |
3 |
Correct |
6 ms |
1412 KB |
Output is correct |
4 |
Correct |
34 ms |
4184 KB |
Output is correct |
5 |
Correct |
10 ms |
1412 KB |
Output is correct |
6 |
Correct |
28 ms |
4316 KB |
Output is correct |
7 |
Correct |
4 ms |
1808 KB |
Output is correct |
8 |
Correct |
0 ms |
1412 KB |
Output is correct |
9 |
Correct |
4 ms |
1412 KB |
Output is correct |
10 |
Correct |
5 ms |
1412 KB |
Output is correct |
11 |
Correct |
3 ms |
1808 KB |
Output is correct |
12 |
Correct |
20 ms |
3392 KB |
Output is correct |
13 |
Correct |
0 ms |
1412 KB |
Output is correct |
14 |
Correct |
7 ms |
1940 KB |
Output is correct |
15 |
Correct |
13 ms |
2072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
2 |
Correct |
0 ms |
1676 KB |
Output is correct |
3 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
4 |
Correct |
24 ms |
3656 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
6 |
Correct |
16 ms |
3392 KB |
Output is correct |
7 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
11 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |
12 |
Correct |
0 ms |
1808 KB |
Output is correct |
13 |
Correct |
27 ms |
3656 KB |
Output is correct |
14 |
Correct |
75 ms |
8936 KB |
Output is correct |
15 |
Execution timed out |
1000 ms |
65536 KB |
Program timed out |