# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574959 | birthdaycake | A Difficult(y) Choice (BOI21_books) | C++17 | 16 ms | 336 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>
#include "books.h"
using namespace std;
long long b[200001];
void solve(int n, int k, long long a, int s) {
set<long long>v; long long a1 = 0, a2 = 0, a3 = -1;
for(int i = 0; i < n; i++) {
b[i] = skim(i + 1);
v.insert(b[i]);
}
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
int tot = a - (b[i] + b[j]) - 1;
auto x = v.upper_bound(tot);
if(*x == b[i]) x = v.upper_bound(*x);
if(*x == b[j]) x = v.upper_bound(*x);
if(x != v.end()){
if(*x + b[i] + b[j] <= a * 2 && *x + b[i] + b[j] >= a ){
a1 = i; a2 = j;
a3 = *x;
}
}
}
}
for(int i = 0; i < n; i++){
if(a3 == b[i]){
vector<int>fin = {i + 1, a1 + 1, a2 + 1};
answer(fin);
}
}
impossible();
}
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... |