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;
const int N = (int) 1e5 + 9;
int n, k, s;
long long a[N], lo, hi;
void solve(int nn, int K, long long A, int S) {
lo = A;
hi = 2 * A;
n = nn; k = K; s = S;
for (int i = 0; i < n; i++) {
a[i] = skim(i + 1);
if (a[i] >= lo) {
n = i + 1;
break;
}
}
map<long long, int> id;
for (int i = 0; i < n; i++) {
id[a[i]] = i;
}
for (int i = 0; i < n; i++) {
set<long long> se;
for (int j = n - 1; j > i; j--) {
long long sum = a[i] - a[j];
auto it = se.lower_bound(lo - sum);
if (it == se.end()) {
continue;
}
if (sum + *it <= hi) {
answer({i + 1, j + 1, id[*it] + 1});
}
se.insert(a[j]);
}
}
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... |