답안 #272174

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
272174 2020-08-18T10:12:40 Z gs18115 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include"advisor.h"
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
void ComputeAdvice(int*C,int N,int K,int M)
{
    map<pi,int,greater<pi> >st;
    vector<int>v(N,N);
    vector<int>nx=v;
    for(int i=N;i-->0;)
        nx[i]=v[C[i]],prv[v[C[i]]]=i,v[C[i]]=i;
    for(int i=0;i<K;i++)
        st[v[i],i]=i;
    vector<int>adv(N+K,1);
    for(int i=0;i<N;i++)
    {
        auto it=st.find(pi(i,C[i]));
        if(it==st.end())
        {
            it=st.begin();
            adv[it->se]=0;
        }
        st.erase(it);
        st[pi(nx[i],C[i])]=N+i;
    }
    for(auto t:st)
        adv[t.se]=0;
    for(int&t:adv)
        WriteAdvice(t);
    return;
}
#include"assistant.h"
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
void Assist(unsigned char*A,int N,int K,int R)
{
    set<int>v1;
    queue<int>v2;
    for(int i=0;i<K;i++)
    {
        if(A[i]==1)
            v1.ep(i);
        else
            v2.ep(i);
    }
    for(int i=0;i<N;i++)
    {
        int c=GetRequest();
        auto it=v1.find(c);
        if(it==v1.end())
        {
            PutBack(v2.front());
            v2.pop();
        }
        else
            v1.erase(it);
        if(A[i+K]==1)
            v1.ep(c);
        else
            v2.ep(c);
    }
    return;
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:19:5: error: 'map' was not declared in this scope
   19 |     map<pi,int,greater<pi> >st;
      |     ^~~
advisor.cpp:6:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    5 | #include<algorithm>
  +++ |+#include <map>
    6 | #define ep emplace
advisor.cpp:19:11: error: expected primary-expression before ',' token
   19 |     map<pi,int,greater<pi> >st;
      |           ^
advisor.cpp:19:12: error: expected primary-expression before 'int'
   19 |     map<pi,int,greater<pi> >st;
      |            ^~~
advisor.cpp:23:23: error: 'prv' was not declared in this scope
   23 |         nx[i]=v[C[i]],prv[v[C[i]]]=i,v[C[i]]=i;
      |                       ^~~
advisor.cpp:25:9: error: 'st' was not declared in this scope; did you mean 'std'?
   25 |         st[v[i],i]=i;
      |         ^~
      |         std
advisor.cpp:29:17: error: 'st' was not declared in this scope; did you mean 'it'?
   29 |         auto it=st.find(pi(i,C[i]));
      |                 ^~
      |                 it
advisor.cpp:38:16: error: 'st' was not declared in this scope; did you mean 't'?
   38 |     for(auto t:st)
      |                ^~
      |                t