Submission #14061

#TimeUsernameProblemLanguageResultExecution timeMemory
14061pl0892029이상한 수열 (OJUZ10_bizarre)C++98
62 / 100
1000 ms65536 KiB
#include <cstdio> #include <set> int arr[50505]; int main() { int n, m; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &arr[i]); } scanf("%d", &m); if (m <= n) { printf("%d", arr[m]); } else { std::set<int> nSet; for (int i = 1; i <= n; ++i) { nSet.insert(arr[i]); } for (int i = n + 1; i < m; ++i) { if (nSet.find(nSet.size()) != nSet.end()) break; nSet.insert(nSet.size()); } printf("%d", nSet.size()); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...