이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
int N, M, inp[50005], chk[3000010], cnt, max;
int main()
{
//freopen("input.txt", "r", stdin);
int i, j;
scanf("%d", &N);
for(i = 1; i <= N; i ++)
{
scanf("%d", &inp[i]);
if(inp[i] > max) max = inp[i];
if(!chk[inp[i] + 1000000]) cnt ++, chk[inp[i] + 1000000] = 1;
}
scanf("%d", &M);
if(M <= N)
{
printf("%d\n", inp[M]);
return 0;
}
for(i = N+1; i <= M; i ++)
{
if(chk[cnt + 1000000])
{
printf("%d\n", cnt);
return 0;
}
if(cnt > max)
{
printf("%d\n", cnt + M - i);
return 0;
}
chk[cnt++ + 1000000] = 1;
}
printf("%d\n", --cnt);
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... |