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 M 1000000
int n, m;
long long int a[3100099];
long long int s[3100000];
int main()
{
int i, j, k, l;
scanf("%d",&n);
for(i=1;i<=n;i++){scanf("%lld",&a[i]);s[a[i]+M]++;}
scanf("%d",&m);
int cnt=0;
for(i=0;i<2*M+20;i++)if(s[i])cnt++;
for(i=n+1;i<2*M+20;i++)
{
a[i]=cnt;
s[cnt+M]++;
if(s[cnt+M]==1)cnt++;
}
if(m<2*M+20)
{
printf("%lld\n",a[m]);
}
else
{
long long int p,q;
p = a[i-2];
q = a[i-1];
{
q+=(m-i+1)*(q-p);
printf("%lld\n",q);
}
}
}
# | 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... |