Submission #408649

#TimeUsernameProblemLanguageResultExecution timeMemory
408649ly20A Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 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.
//
const int MAXN = 112345;
long long qr[MAXN];
long long val(int a) {
    if(qr[a] == -1) qr[a] = skim(a);
    return qr[a];
}
long long ts(int a, int b, int c, int d) {
    long long tst = 0;
    for(int i = a; i <= b; i++) tst += qr[i];
    for(int i = c; i <= d; i++) tst += qr[i];
    return tst;
}
void solve(int n, int k, long long a, int s) {
    // TODO implement this function
    for(int i = 1; i <= n; i++) qr[i] = -1;
    int ini = 1, fim = n;
    while(ini < fim) {
        int m = (ini + fim) / 2;
        if()
        if(val(m) >= a) ini = m;
        else fim = m - 1;
    }
    long long vlm = val(ini);
    if(val[fim] <= a) {
        fim++;
        ini++;
        vlm = 1123456789012345678;
    }
    if(ts(1, k - 1, 0, -1) + vlm <= 2 * a) {
        vector <int> temp;
        for(int i = 1; i < k; i++) temp.push_back(i);
        temp.push_back(ini);
        answer(temp);
    }
    for(int i = 0; i <= k; i++) {
        if(ts(1, i, ini - k + i, ini - 1) <= 2 * a && ts(1, i, ini - k + i, ini - 1) >= a) {
            vector <int> temp;
            for(int j = 1; j <= i; j++) temp.push_back(j);
            for(int  j = ini - k + i; j < ini; j++) temp.push_back(j);
            answer(temp);
        }
    }
    impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:33:12: error: expected primary-expression before ')' token
   33 |         if()
      |            ^
books.cpp:33:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   33 |         if()
      |           ^
books.cpp:38:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |     if(val[fim] <= a) {
      |               ^
books.cpp:38:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |     if(val[fim] <= a) {
      |        ~~~~~~~~~^~~~