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 <stdio.h>
#define MAX 1000001
int arr[MAX];
int check[MAX];
int main()
{
int n;
scanf("%d", &n);
int i, j;
for (i = 1; i <= n; i++)
scanf("%d", &arr[i]);
for (i = 1; i <= n; i++)
{
check[i] = 1;
for (j = 1; j <= n; j++)
{
if (i == j)
continue;
if (arr[i] == arr[j] &&check[j] == 0)
{
check[j] = 1;
arr[j] = 0;
}
}
}
int a = 0;
for (i = 1; i <= n; i++)
{
if (arr[i] != 0)
a += 1;
}
int m;
scanf("%d", &m);
arr[n + 1] = a;
int sum = a;
for (i = n + 1; i <= m; i++)
{
sum += 1;
for (j = 1; j <= n; j++)
{
if (arr[i] == arr[j])
{
sum -= 1;
break;
}
}
arr[i + 1] = sum;
}
printf("%d", arr[m]);
return 0;
}
# | 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... |