#include<stdio.h>
#define M 1000000
int n, m;
int a[3100099];
int s[3100000];
int main()
{
int i, j, k, l;
scanf("%d",&n);
for(i=0;i<n;i++){scanf("%d",&a[i]);s[a[i]+M]++;}
scanf("%d",&m);
int cnt=0;
for(i=0;i<2*M+2;i++)if(s[i])cnt++;
for(i=n;i<=m&& i<2*M+20;i++)
{
a[i]=cnt;
s[cnt+M]++;
if(s[cnt+M]==1)cnt++;
}
if(m<2*M+2)
{
printf("%d\n",a[m]);
}
else
{
int p,q;
p = a[i-2];
q = a[i-1];
if(p==q)printf("%d\n",p);
else
{
q+=(m-i)*(q-p);
printf("%d\n",q);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
25300 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
25300 KB |
Output is correct |
2 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
25300 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
25300 KB |
Output isn't correct |
5 |
Correct |
0 ms |
25300 KB |
Output is correct |
6 |
Correct |
3 ms |
25300 KB |
Output is correct |
7 |
Incorrect |
3 ms |
25300 KB |
Output isn't correct |
8 |
Correct |
0 ms |
25300 KB |
Output is correct |
9 |
Incorrect |
0 ms |
25300 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
25300 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
25300 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
25300 KB |
Output isn't correct |
3 |
Correct |
7 ms |
25300 KB |
Output is correct |
4 |
Incorrect |
9 ms |
25300 KB |
Output isn't correct |
5 |
Incorrect |
7 ms |
25300 KB |
Output isn't correct |
6 |
Incorrect |
11 ms |
25300 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
25300 KB |
Output isn't correct |
8 |
Incorrect |
5 ms |
25300 KB |
Output isn't correct |
9 |
Incorrect |
11 ms |
25300 KB |
Output isn't correct |
10 |
Incorrect |
7 ms |
25300 KB |
Output isn't correct |
11 |
Correct |
0 ms |
25300 KB |
Output is correct |
12 |
Incorrect |
5 ms |
25300 KB |
Output isn't correct |
13 |
Incorrect |
9 ms |
25300 KB |
Output isn't correct |
14 |
Correct |
5 ms |
25300 KB |
Output is correct |
15 |
Incorrect |
18 ms |
25300 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
25300 KB |
Output is correct |
2 |
Correct |
15 ms |
25300 KB |
Output is correct |
3 |
Correct |
21 ms |
25300 KB |
Output is correct |
4 |
Correct |
15 ms |
25300 KB |
Output is correct |
5 |
Correct |
13 ms |
25300 KB |
Output is correct |
6 |
Correct |
8 ms |
25300 KB |
Output is correct |
7 |
Correct |
22 ms |
25300 KB |
Output is correct |
8 |
Correct |
20 ms |
25300 KB |
Output is correct |
9 |
Correct |
18 ms |
25300 KB |
Output is correct |
10 |
Correct |
24 ms |
25300 KB |
Output is correct |
11 |
Correct |
4 ms |
25300 KB |
Output is correct |
12 |
Correct |
20 ms |
25300 KB |
Output is correct |
13 |
Correct |
20 ms |
25300 KB |
Output is correct |
14 |
Correct |
22 ms |
25300 KB |
Output is correct |
15 |
Correct |
19 ms |
25300 KB |
Output is correct |