# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25005 | bugmenot111 | Hindeks (COCI17_hindeks) | C11 | 103 ms | 8928 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAXN 1000100
int v[MAXN];
int score[MAXN];
int n;
bool check(int h) {
int s = 0;
for(int i = 0; i < n; i++) if(score[i] >= h) s++;
return s >= h;
}
int cmp(const int* a, const int* b) {
bool c1 = check(b - v), c2 = check(b - v + 1);
return c1 ? (c2 ? 1 : 0) : -1;
}
int main(void) {
int j = 15;
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", &score[i]);
int* ans = bsearch(&j, v, MAXN, sizeof(int), cmp);
printf("%d\n", ans - v);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |