답안 #381835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381835 2021-03-26T03:52:01 Z thecodingwizard 최후의 만찬 (IOI12_supper) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "assistant.h"

using namespace std;

#define f first
#define s second

void Assist(unsigned char *A, int N, int K, int R) {
    map<int, int> useLeft;
    int idx = 0;
    map<int, int> pos;
    map<int, int> revPos;
    queue<int> toRemove;
    for (int i = 0; i < K; i++) {
        int ct = 0;
        while (A[idx] != 0) {
            ct++;
            idx++;
        }
        idx++;
        useLeft[i] = ct;
        cout << i << " will be used " << ct << " times " << endl;
        if (ct == 0) toRemove.push(i);
        pos[i] = i;
        revPos[i] = i;
    }

    for (int i = 0; i < N; i++) {
        int req = GetRequest();
        if (pos.count(req)) {
            useLeft[pos[req]]--;
            if (useLeft[pos[req]] == 0) {
                toRemove.push(pos[req]);
            }
        } else {
            int remove = toRemove.front(); toRemove.pop();
            PutBack(revPos[remove]);
            pos.erase(revPos[remove]);
            revPos[remove] = req;
            pos[req] = remove;
            int ct = 0;
            if (idx == R) {
                ct = 10000000;
            } else {
                while (A[idx] != 0) {
                    ct++;
                    idx++;
                }
                idx++;
            }
            useLeft[remove] = ct;
            if (ct == 0) {
                toRemove.push(remove);
            }
        }
    }
}



    

Compilation message

/tmp/ccytCpJJ.o: In function `Assist(unsigned char*, int, int, int)':
advisor.cpp:(.text+0x481): undefined reference to `GetRequest()'
advisor.cpp:(.text+0x565): undefined reference to `PutBack(int)'
/tmp/ccUDNWfD.o: In function `main':
advisor_grader.cpp:(.text.startup+0xde): undefined reference to `ComputeAdvice(int*, int, int, int)'
collect2: error: ld returned 1 exit status

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