Submission #546455

#TimeUsernameProblemLanguageResultExecution timeMemory
546455d4xnA Difficult(y) Choice (BOI21_books)C++17
5 / 100
194 ms976 KiB
#include <bits/stdc++.h>

#include "books.h"

using namespace std;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
//     books.h books_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ books_sample.cpp sample_grader.cpp
// in this folder.
//

#define ll long long

void solve(int N, int K, long long A, int S) {
    // TODO implement this function
    // impossible()
    // answer()
    // puedo hacer S preguntas
    // hay N libros
    // ordenados de mayor a menor por precio
    // tengo que comprar K
    // y la suma tiene que ser >= A y <= A*2

    vector<ll> v(N+1);
    for (int i = 1; i <= N; i++) {
        v[i] = skim(i);
    }

    for (int i = 1; i <= N-2; i++) {
        for (int j = i+1; j <= N-1; j++) {
            for (int k = j+1; k <= N; k++) {
                ll x = v[i] + v[j] + v[k];
                if (A <= x && x <= A*2) {
                    vector<int> ans = {i, j, k};
                    answer(ans);
                }
            }
        }
    }

    impossible();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...