답안 #870173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870173 2023-11-07T06:52:11 Z HuyQuang_re_Zero 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
#define N 200005
#include "advisor.h"
//#define WriteAdvice(k) cout<<k<<'\n';
using namespace std;
struct International_Olympiad_in_Informatics
{
    int nxt[N],request[N],i,k,n,m,c[N],pos[N],res[N],now[N];
    void Work(int c[],int n,int k,int m)
    {
        m=0;
        for(i=1;i<=k;i++) request[++m]=i;
        for(i=1;i<=n;i++) request[++m]=c[i];
        memset(pos,63,sizeof(pos));
        for(i=m;i>=1;i--) nxt[i]=pos[request[i]],pos[request[i]]=i;
        set <II> s;
        for(i=1;i<=m;i++)
        {
            int x=request[i];
         //   cout<<x<<" ";
            if(i<=k) s.insert({ nxt[i],x });
            else if(s.find({ i,x })!=s.end())
            {
                s.erase({ i,x });
                s.insert({ nxt[i],x });
            }
            else
            {
                set <II>::iterator it=s.end(); it--;
                II tg=*it; s.erase(tg);
                res[now[tg.snd]]=1;
                s.insert({ nxt[i],x });
            //    cerr<<tg.snd<<" "<<x<<'\n';
            }
            now[x]=i;
        }
      //  cout<<'\n';
    }
} IOI;


int n,k,m,c[N],i;
void ComputeAdvice(int _c[],int n,int k,int m)
{
    for(int i=n;i>=1;i--) c[i]=_c[i-1],c[i]++;
    IOI.Work(c,n,k,m);
    for(int i=1;i<=n+k;i++) WriteAdvice(IOI.res[i]);
}
/*
int main()
{
    freopen("advisor.inp","r",stdin);
    freopen("advisor.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>k>>m;
    for(i=0;i<n;i++) cin>>c[i];
    ComputeAdvice(c,n,k,m);
}
*/
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
#define N 200005
#include "assist.h"
//#define PutBack(x) cout<<x<<'\n';
using namespace std;
struct International_Olympiad_in_Informatics
{
    int n,k,m,i,in[N];
    int a[N];
    set <int> s;
    void Init(unsigned char _a[],int _n,int _k,int _m)
    {
        n=_n; k=_k; m=_m;
        for(i=1;i<=m;i++) a[i]=_a[i]-'0';
    }
    int add(int i,int x)
    {
        if(i<=k)
        {
         //   cerr<<i<<" "<<a[i]<<'\n';
            if(a[i]==1) s.insert(x);
            in[x]=1;
            return 0;
        }
        else if(in[x]==1)
        {
            s.erase(x);
            if(a[i]==1) s.insert(x);
            in[x]=1;
            return 0;
        }
        else
        {
            int y=*s.begin(); s.erase(y);
            in[y]=0;
            if(a[i]==1) s.insert(x);
            in[x]=1;
            return y;
        }
    }
} IOI;


//int GetRequest() { int k; cin>>k; return k; }
int n,k,r,i;
unsigned char a[N];
void Assist(unsigned char _a[], int n, int k, int r)
{
    for(i=r;i>=1;i--) a[i]=_a[i-1];
    IOI.Init(a,n,k,r);
    for(i=1;i<=k;i++) IOI.add(i,i);
    for(i=k+1;i<=k+n;i++)
    {
        int x=GetRequest(),k=IOI.add(i,x+1);
        if(k>0) PutBack(k-1);
    }
}
/*
int main()
{
    freopen("assist.inp","r",stdin);
    freopen("assist.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>k>>r;
    for(i=0;i<r;i++) cin>>a[i];
    Assist(a,n,k,r);
}*/

Compilation message

assistant.cpp:16:10: fatal error: assist.h: No such file or directory
   16 | #include "assist.h"
      |          ^~~~~~~~~~
compilation terminated.