This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |