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) {
vector<long long> x(n);
for (int i = 0; i < n; i++) x[i] = skim(i + 1);
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
long long sum = x[i] + x[j];
if (sum >= a) break;
// sum + x >= a
// x >= a - sum
auto it = lower_bound(x.begin() + j + 1, x.end(), a - sum);
if (it == x.end()) continue;
int id = *it;
sum += x[id];
if (sum <= 2 * a) answer({ i + 1, j + 1, id + 1 });
}
}
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... |