이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma warning(disable:4996)
#include <stdio.h>
#include <set>
using namespace std;
int n, m;
int a[50000];
set<int> s;
int main()
{
scanf("%d", &n);
for (int i=0; i<n; i++) scanf("%d", &a[i]), s.insert(a[i]);
scanf("%d", &m);
if (m<=n) {
printf("%d\n", a[m-1]);
}
else {
m -= n+1;
int b = s.size();
int e;
// B_n+1 = b
auto it = s.lower_bound(b);
if (it == s.end()) e = 2000000000;
else e = *it;
if (b+m <= e) printf("%d\n", b+m);
else printf("%d\n", e);
}
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... |