# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29453 | kdh9949 | Taxis (POI13_tak) | C++14 | 169 ms | 5924 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, t;
ll d, b, x, a[500010];
int main(){
scanf("%lld%lld%d", &d, &b, &n);
for(int i = 0; i < n; i++) scanf("%lld", a + i);
sort(a, a + n, greater<int>());
t = int(upper_bound(a, a + n, d - b, greater<int>()) - a - 1);
int cnt = 0;
for(int i = 0; i < n; i++){
if(a[i] >= max(d - b, b + d - 2 * x)){
printf("%d\n", cnt + 1);
return 0;
}
if(i == t) continue;
x += a[i] - (b - x);
cnt++;
if(a[t] >= max(d - b, b + d - 2 * x)){
printf("%d\n", cnt + 1);
return 0;
}
}
puts("0");
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |