Submission #624386

# Submission time Handle Problem Language Result Execution time Memory
624386 2022-08-08T05:49:55 Z pirhosig Last supper (IOI12_supper) C++17
0 / 100
150 ms 15812 KB
#include "advisor.h"
#include <bits/stdc++.h>
#define  R(a) for (int i = 0; i < a; ++i)
#define ii pair<int, int>
using namespace std;



void ComputeAdvice(int *C, int N, int K, int M) {
    unordered_map<int, vector<int>> mpa;
    R(N) {
        int a = C[i];
        mpa[a].push_back(i);
    }

    unordered_set<int> val;
    R(K) {
        val.insert(i);
    }

    priority_queue<ii> que;
    R(K) {
        if (!mpa[i].size()) que.push({INT_MAX, i});
        else que.push({mpa[i][0], i});
    }

    bool init[K] {};
    bool rem[N] {};
    vector<int> last(N, -1);
    R(N) {
        int a = C[i];
        last[a] = i;
        if (val.count(a)) continue;
        auto b = que.top();
        que.pop();
        int c = b.second;
        if (last[c] == -1) init[c] = true;
        rem[last[c]] = true;

        auto it = upper_bound(mpa[a].begin(), mpa[a].end(), i);
        if (it == mpa[a].end()) que.push({INT_MAX, a});
        else que.push({*it, a});
    }

    R(K) {
        if (init[i]) WriteAdvice(1);
        else WriteAdvice(0);
    }
    R(N) {
        if (rem[i]) WriteAdvice(1);
        else WriteAdvice(0);
    }
}
#include "assistant.h"
#include <bits/stdc++.h>
#define  R(a) for (int i = 0; i < a; ++i)
#define ii pair<int, int>
using namespace std;



void Assist(unsigned char *A, int N, int K, int R) {
    queue<int> rem;
    unordered_set<int> val;
    R(K) {
        val.insert(i);
        if (A[i]) rem.push(i);
    }
    R(N) {
        int a = GetRequest();
        if (!val.count(a)) {
            PutBack(rem.front());
            rem.pop();
        }
        if (A[K + i]) {
            rem.push(a);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 580 KB Output is correct
2 Incorrect 2 ms 520 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1796 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 10100 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1064 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 11932 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 136 ms 12488 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 102 ms 12676 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 96 ms 12604 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 97 ms 12588 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 104 ms 12660 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 150 ms 12608 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 100 ms 12668 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 118 ms 12876 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 98 ms 15812 KB Error - Putting back a color when it is already on the scaffold