# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
83546 |
2018-11-08T23:10:23 Z |
leejseo |
이상한 수열 (OJUZ10_bizarre) |
C++14 |
|
1000 ms |
6344 KB |
#include <bits/stdc++.h>
using namespace std;
int N, M;
int S[50001];
set<int> T;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin >> N;
for (int i=1; i<=N; i++){
cin >> S[i];
T.insert(S[i]);
}
cin >> M;
if (M <= N){
cout << S[M] << endl;
return 0;
}
if ((signed) T.size() > *T.rbegin()){
cout << T.size() + M - N - 1 << endl;
return 0;
}
int i = N+1;
while (1){
if (i == M){
cout << T.size() << endl;
return 0;
}
if (T.lower_bound(T.size()) != T.end()){
T.insert(T.size());
i++;
continue;
}
cout << T.size() + M - i << endl;
return 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
564 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
2 ms |
588 KB |
Output is correct |
5 |
Correct |
2 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
740 KB |
Output is correct |
2 |
Correct |
2 ms |
724 KB |
Output is correct |
3 |
Correct |
2 ms |
960 KB |
Output is correct |
4 |
Correct |
2 ms |
1096 KB |
Output is correct |
5 |
Correct |
2 ms |
872 KB |
Output is correct |
6 |
Correct |
2 ms |
872 KB |
Output is correct |
7 |
Correct |
3 ms |
872 KB |
Output is correct |
8 |
Correct |
2 ms |
964 KB |
Output is correct |
9 |
Correct |
2 ms |
960 KB |
Output is correct |
10 |
Correct |
2 ms |
1096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
6344 KB |
Output is correct |
2 |
Correct |
9 ms |
2244 KB |
Output is correct |
3 |
Correct |
27 ms |
5520 KB |
Output is correct |
4 |
Correct |
10 ms |
1376 KB |
Output is correct |
5 |
Correct |
9 ms |
1876 KB |
Output is correct |
6 |
Correct |
5 ms |
1876 KB |
Output is correct |
7 |
Correct |
29 ms |
5980 KB |
Output is correct |
8 |
Correct |
7 ms |
1876 KB |
Output is correct |
9 |
Correct |
20 ms |
3300 KB |
Output is correct |
10 |
Correct |
9 ms |
1956 KB |
Output is correct |
11 |
Correct |
11 ms |
2448 KB |
Output is correct |
12 |
Correct |
4 ms |
1876 KB |
Output is correct |
13 |
Correct |
6 ms |
1876 KB |
Output is correct |
14 |
Correct |
7 ms |
1668 KB |
Output is correct |
15 |
Correct |
23 ms |
4456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
2 |
Execution timed out |
1078 ms |
6344 KB |
Time limit exceeded |