Submission #1009183

#TimeUsernameProblemLanguageResultExecution timeMemory
1009183alexddA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;

map<int,int> mp;
int query(int x)
{
    if(mp[x]==0) mp[x] = skim(x);
    return mp[x];
}

pair<long long,long long> aproximativ(int st, int K)
{
    int dr = st+K-1;
    long long x = query(st);
    long long y = query(dr);
    pair<long long,long long> aux = {x+y,x+y};
    for(int i=2;i<K;i++)
    {
        aux.first += x+i-1;
        aux.second += y-i+1;
    }
    return aux;
}
long long exact(int st, int K)
{
    int dr = st+K-1;
    long long sum=0;
    for(int i=st;i<=dr;i++)
        sum += query(i);
    return sum;
}

void solve(int N, int K, long long A, int S)
{
    int st=1,dr=n-k+1,ans=-1;
    while(st<=dr)
    {
        int mij=(st+dr)/2;
        if(exact(mij,K)>=a)
        {
            if(exact(mij,K)<=2*a)
            {
                vector<int> sol;
                for(int i=mij;i<mij+K;i++)
                    sol.push_back(i);
                answer(sol);
                return;
            }
            dr = mij-1;
        }
        else
            st = mij+1;
    }
    impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:36:17: error: 'n' was not declared in this scope
   36 |     int st=1,dr=n-k+1,ans=-1;
      |                 ^
books.cpp:36:19: error: 'k' was not declared in this scope
   36 |     int st=1,dr=n-k+1,ans=-1;
      |                   ^
books.cpp:40:26: error: 'a' was not declared in this scope
   40 |         if(exact(mij,K)>=a)
      |                          ^