답안 #649421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
649421 2022-10-10T07:54:42 Z activedeltorre Inside information (BOI21_servers) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

//#include "books.h"
#include "books.h"
using namespace std;

/*int v[100005];
int vo[100005];
int skim(int i)
{
    return vo[i];
}
void answer(vector<int>vectorus)
{
    int i;
    for(i=0;i<vectorus.size();i++)
    {
        cout<<vectorus[i]<<" ";
    }
}
void impossible()
{
    cout<<"imp";
}*/
void solve(int N,int K,long long A,int S)
{
    long long i,n,k,val,sol,j,a;
    n=N;
    k=K;
    a=A;
    vector<int>vec;
    vec.push_back(0);
    long long v[100005],suma=0,st,dr,mij;
    for(i=1;i<=k-1;i++)
    {
        v[i]=skim(i);
        suma=suma+v[i];
    }
    if(suma>=A)
    {
        v[k]=skim(k);
        suma=suma+v[k];
        if(suma>a*2)
        {
            impossible();
        }
        else
        {
            for(i=1;i<=k;i++)
            {
                vec.push_back(i);
            }
            answer(vec);
        }
        return;
    }
    else
    {
        st=k;
        dr=n;
        sol=0;
        while(st<=dr)
        {
            mij=(st+dr)/2;
            val=skim(mij);
            if(val+suma<=2*a && val+suma>=a)
            {
                for(i=1;i<k;i++)
                {
                    vec.push_back(i);
                }
                vec.push_back(mij);
                answer(vec);
                return;
            }
            else if(val+suma<a)
            {
                dr=mij-1;
                sol=mij;
            }
            else
            {
                st=mij+1;
            }
        }
        val=skim(k);
        v[k]=val;
        suma=suma+val;
        if(suma>=a && suma<=2*a)
        {
            for(i=1;i<=k;i++)
            {
                vec.push_back(i);
            }
            answer(vec);
            return;
        }
        for(i=1;i<=k;i++)
        {
            if(i>=sol)
            {
                impossible();
                return;
            }
            suma=suma-v[i];
            suma=suma+skim(sol-i+1);
            if(suma>=a && suma<=2*a)
            {
                for(j=i+1;j<=k;j++)
                {
                    vec.push_back(j);
                }
                for(j=1;j<=i;j++)
                {
                    vec.push_back(sol-j+1);
                }
                answer(vec);
                return;
            }
        }
        impossible();
        return;
    }
}
/*int main()
{
    int n,i,j,k,l,suma,o;
    cin>>n>>k>>suma>>o;
    for(i=1;i<=n;i++)
    {
        cin>>vo[i];
    }
    solve(n,k,suma,o);
}*/

Compilation message

servers.cpp:4:10: fatal error: books.h: No such file or directory
    4 | #include "books.h"
      |          ^~~~~~~~~
compilation terminated.