Submission #157306

# Submission time Handle Problem Language Result Execution time Memory
157306 2019-10-10T14:11:27 Z dolphingarlic Last supper (IOI12_supper) C++14
Compilation error
0 ms 0 KB
#include "advisor.h"
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
using namespace std;

set<pair<int, int>> scaffold;
queue<int> occurrences[100000];
int swap_sequence[100000];
bool on_scaffold[100000];

void ComputeAdvice(int *C, int N, int K, int M) {
    FOR(i, 0, N) occurrences[C[i]].push(i);
    FOR(i, 0, N) occurrences[i].push(INT_MAX);

    FOR(i, 0, K) scaffold.insert({-occurrences[i].front(), i});

    FOR(i, 0, N) {
        if (on_scaffold[C[i]]) {
            swap_sequence[i] = C[i];
            scaffold.erase({-occurrences[C[i]].front(), C[i]});
        } else {
            swap_sequence[i] = (*scaffold.begin()).second;
            on_scaffold[(*scaffold.begin()).second] = false;
            scaffold.erase(scaffold.begin());
        }
        occurrences[C[i]].pop();
        scaffold.insert({-occurrences[C[i]].front(), C[i]});
        on_scaffold[C[i]] = true;
    }

    FOR(i, 0, N) {
        
    }
}
#include "assistant.h"
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
using namespace std;

set<pair<int, int>> scaffold;
int on_scaffold[100000];

void Assist(unsigned char *A, int N, int K, int R) {
    FOR(i, 0, K) {
        scaffold.insert({A[i] - '0', i});
        on_scaffold[i] = A[i] - '0' + 1;
    }

    FOR(i, K, N + K) {
        int nxt = GetRequest();
        if (on_scaffold[nxt]) {
            scaffold.erase({on_scaffold[nxt] - 1, nxt});
            scaffold.insert({A[i] - '0', nxt});
        } else {
            putback((*scaffold.begin()).second);
            on_scaffold[(*scaffold.begin()).second] = 0;
            scaffold.erase(scaffold.begin());
            scaffold.insert({A[i] - '0', nxt});
        }
        on_scaffold[nxt] = A[i] - '0' + 1;
    }
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:21:13: error: 'putback' was not declared in this scope
             putback((*scaffold.begin()).second);
             ^~~~~~~
assistant.cpp:21:13: note: suggested alternative: 'PutBack'
             putback((*scaffold.begin()).second);
             ^~~~~~~
             PutBack