Submission #14015

#TimeUsernameProblemLanguageResultExecution timeMemory
14015pjsdream이상한 수열 (OJUZ10_bizarre)C++14
100 / 100
32 ms3652 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...