제출 #1009205

#제출 시각아이디문제언어결과실행 시간메모리
1009205alexddA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;

map<int,int> mp;
int ramase;
int query(int x)
{
    if(mp[x]==0)
    {
        if(ramase==0)
        {
            while(1);
        }
        ramase--;
        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)
{
    ramase = S;
    /*int st=1,dr=N-K+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;
    }*/
    for(int st=1;st<=N-K+1;st++)
    {
        if(exact(st,K)>=A && exact(st,K)<=2*a)
        {
            vector<int> sol;
            for(int i=mij;i<mij+K;i++)
                sol.push_back(i);
            answer(sol);
            return;
        }
    }
    impossible();
}

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:67:45: error: 'a' was not declared in this scope
   67 |         if(exact(st,K)>=A && exact(st,K)<=2*a)
      |                                             ^
books.cpp:70:23: error: 'mij' was not declared in this scope
   70 |             for(int i=mij;i<mij+K;i++)
      |                       ^~~