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>
#include "books.h"
using namespace std;
void solve(int n, int k, long long A, int s) {
long long a[n + 1];
for (int i = 1; i <= n; i++)
a[i] = skim(i);
for (int i = 1; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
long long sum = a[i] + a[j];
if (sum > 2 * A)
continue;
int l = j + 1, r = n;
while (r - l > 1) {
int m = (l + r) >> 1;
if (a[m] >= A - sum)
r = m;
else
l = m;
}
int ind = -1;
if (a[l] >= A - sum) ind = l;
else if (a[r] >= A - sum) ind = r;
if (ind != -1 && sum + a[ind] <= 2 * A) {
answer({i, j, ind});
return;
}
}
}
impossible();
}
# | 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... |