답안 #288080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
288080 2020-09-01T08:35:43 Z ToMmyDong 최후의 만찬 (IOI12_supper) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define ALL(i) i.begin(), i.end()
#define SZ(i) int(i.size())
#define X first
#define Y second
#ifdef tmd
#define debug(...) fprintf(stderr,"#%d-(%s)=",__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y) {cerr<<x<<",";_do(y...);}
template<typename IT> ostream& __printRng (ostream& os, IT bg, IT ed) {
    for (IT it=bg;it!=ed;it++) {
        if (it == bg) os << "{" << *it;
        else os << "," << *it;
    }
    return os << "}";
}
template<typename T> ostream& operator << (ostream& os, const vector<T> &vec) {
    return __printRng(os, ALL(vec));
}
template<typename T, typename S> ostream& operator << (ostream& os, const pair<T,S> &pa) {
    return os << "{" << pa.X << "," << pa.Y << "}";
}
#else
#define debug(...)
#endif

#include "assistant.h"

void Assist(unsigned char *a, int n, int k, int r) {

    vector<int> c(n);
    for (int i=0, ptr=0; i<n; i++) {
        for (int j=0; j<20; j++) {
            if (a[ptr++]) c[i] += (1<<j);
        }
    }

    vector<int> nxt(n);
    vector<int> lst(n, n);
    for (int i=n-1; i>=0; i--) {
        nxt[i] = lst[c[i]];
        lst[c[i]] = i;
    }

    priority_queue<pii> pq;
    set<int> st;
    for (int i=0; i<k; i++) {
        pq.emplace(pii(lst[i], i));
        st.insert(i);
        debug(lst[i], i);
    }
    for (int i=0; i<n; i++) {
        int req = GetRequest();
        assert(c[i] == req);
        if (!st.count(req)) {
            pii cur = pq.top();
            pq.pop();
            debug(cur);
            debug(nxt[i], req);

            PutBack(cur.Y);
            st.erase(cur.Y);
            st.insert(req);
            pq.emplace(nxt[i], req);
        }
    }


}



    

Compilation message

/tmp/ccZgmaxr.o: In function `Assist(unsigned char*, int, int, int)':
advisor.cpp:(.text+0x376): undefined reference to `GetRequest()'
advisor.cpp:(.text+0x3f6): undefined reference to `PutBack(int)'
/tmp/ccutlwHP.o: In function `main':
advisor_grader.cpp:(.text.startup+0xc9): undefined reference to `ComputeAdvice(int*, int, int, int)'
collect2: error: ld returned 1 exit status

/tmp/ccgVga64.o: In function `main':
assistant_grader.cpp:(.text.startup+0x21f): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status