# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13946 |
2015-04-24T14:50:10 Z |
ainta |
이상한 수열 (OJUZ10_bizarre) |
C++ |
|
14 ms |
1476 KB |
#include<stdio.h>
#include<algorithm>
using namespace std;
int w[101000], n, m, c;
int main(){
int i, t;
scanf("%d", &n);
for (i = 1; i <= n; i++){
scanf("%d", &w[i]);
}
scanf("%d", &m);
if (m <= n){
printf("%d\n", w[m]);
return 0;
}
sort(w + 1, w + n + 1);
for (i = 1; i <= n; i++){
if (i == 1 || w[i] != w[i - 1])c++;
}
for (i = 1; i <= n; i++)if (w[i] >= c)break;
t = i;
if (t == n + 1 || w[t] - c > m - (n+1)){
printf("%d\n", m - (n + 1) + c);
}
else printf("%d\n", w[t]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1476 KB |
Output is correct |
2 |
Correct |
0 ms |
1476 KB |
Output is correct |
3 |
Correct |
0 ms |
1476 KB |
Output is correct |
4 |
Correct |
0 ms |
1476 KB |
Output is correct |
5 |
Correct |
0 ms |
1476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1476 KB |
Output is correct |
2 |
Correct |
0 ms |
1476 KB |
Output is correct |
3 |
Correct |
0 ms |
1476 KB |
Output is correct |
4 |
Correct |
0 ms |
1476 KB |
Output is correct |
5 |
Correct |
0 ms |
1476 KB |
Output is correct |
6 |
Correct |
0 ms |
1476 KB |
Output is correct |
7 |
Correct |
0 ms |
1476 KB |
Output is correct |
8 |
Correct |
0 ms |
1476 KB |
Output is correct |
9 |
Correct |
0 ms |
1476 KB |
Output is correct |
10 |
Correct |
0 ms |
1476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1476 KB |
Output is correct |
2 |
Correct |
0 ms |
1476 KB |
Output is correct |
3 |
Correct |
5 ms |
1476 KB |
Output is correct |
4 |
Correct |
2 ms |
1476 KB |
Output is correct |
5 |
Correct |
5 ms |
1476 KB |
Output is correct |
6 |
Correct |
3 ms |
1476 KB |
Output is correct |
7 |
Correct |
13 ms |
1476 KB |
Output is correct |
8 |
Correct |
0 ms |
1476 KB |
Output is correct |
9 |
Correct |
14 ms |
1476 KB |
Output is correct |
10 |
Correct |
3 ms |
1476 KB |
Output is correct |
11 |
Correct |
1 ms |
1476 KB |
Output is correct |
12 |
Correct |
0 ms |
1476 KB |
Output is correct |
13 |
Correct |
5 ms |
1476 KB |
Output is correct |
14 |
Correct |
0 ms |
1476 KB |
Output is correct |
15 |
Correct |
4 ms |
1476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1476 KB |
Output is correct |
2 |
Correct |
14 ms |
1476 KB |
Output is correct |
3 |
Correct |
0 ms |
1476 KB |
Output is correct |
4 |
Correct |
10 ms |
1476 KB |
Output is correct |
5 |
Correct |
11 ms |
1476 KB |
Output is correct |
6 |
Correct |
7 ms |
1476 KB |
Output is correct |
7 |
Correct |
6 ms |
1476 KB |
Output is correct |
8 |
Correct |
3 ms |
1476 KB |
Output is correct |
9 |
Correct |
9 ms |
1476 KB |
Output is correct |
10 |
Correct |
4 ms |
1476 KB |
Output is correct |
11 |
Correct |
13 ms |
1476 KB |
Output is correct |
12 |
Correct |
0 ms |
1476 KB |
Output is correct |
13 |
Correct |
13 ms |
1476 KB |
Output is correct |
14 |
Correct |
3 ms |
1476 KB |
Output is correct |
15 |
Correct |
11 ms |
1476 KB |
Output is correct |