Submission #14184

#TimeUsernameProblemLanguageResultExecution timeMemory
14184ainu7이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
49 ms4160 KiB
#include <math.h> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <queue> #include <map> #include <algorithm> #include <cmath> #include <iostream> #include <sstream> #include <set> using namespace std; int main() { int N; cin >> N; vector<int> V(N); set<int> S; for (int i=0; i<N; i++) { cin >> V[i]; S.insert(V[i]); } int M; cin >> M; M --; if (M < N) { cout << V[M] << endl; return 0; } int sz = S.size(); S.insert(1999999999); int last = *(S.lower_bound(sz)); M -= N; cout << min(sz + M, last) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...