답안 #118022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118022 2019-06-17T17:33:10 Z baqargam 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "advisor.h"
//#include "grader.h"

using namespace std;

void ComputeAdvice(int *C, int n, int k, int m) {
    int ls[100005],nx[100005];
    priority_queue<pair<int,int> >q;
    vector<pair<int,int> >ret;
    for(int i=0;i<n;i++){
        ls[i]=1000000000;
        nx[i]=0;
    }
    for(int i=n-1;i>=0;i--){
        nx[i]=ls[C[i]];
        ls[C[i]]=i;
    }
    for(int i=0;i<k;i++){
        q.push_back({ls[i],i});
    }
    for(int i=k;i<=n;i++){
        int a=q.top().first;
        int j=q.top().second;
        q.pop();
        ret.push_back({j,1});
        q.push({nx[C[i-k]],i});
    }
    sort(ret.begin(),ret.end());
    for(int i=0;i<k+n;i++){
        WriteAdvice(ret[i].second);
    }
}





#include<bits/stdc++.h>
#include "assistant.h"
//#include "grader.h"

using namespace std;

void Assist(unsigned char *A, int n, int k, int r) {
    for(int i=0;i<k;i++){
        if(A[i]==1) q.push(i);
    }
    for(int i=0;i<n;i++){
        int a=GetRequest();
        PutBack(q.front());
        q.pop();
        if(A[i]==1) q.push(a);
    }


}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:20:11: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'push_back'
         q.push_back({ls[i],i});
           ^~~~~~~~~
advisor.cpp:23:13: warning: unused variable 'a' [-Wunused-variable]
         int a=q.top().first;
             ^

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:9:21: error: 'q' was not declared in this scope
         if(A[i]==1) q.push(i);
                     ^
assistant.cpp:13:17: error: 'q' was not declared in this scope
         PutBack(q.front());
                 ^