Submission #990484

# Submission time Handle Problem Language Result Execution time Memory
990484 2024-05-30T14:14:59 Z 12345678 Last supper (IOI12_supper) C++17
0 / 100
22 ms 9232 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

const int nxx=1e5+5;

int bits;
vector<int> d[nxx], idx(nxx);
set<pair<int, int>> mx;

void ComputeAdvice(int *C, int N, int K, int M) {
    bits=ceil(log2(K));
    for (int i=N-1; i>=0; i--) d[C[i]].push_back(i);
    for (int i=0; i<K; i++)
    {
        idx[i]=i;
        if (d[i].empty()) mx.insert({1e9, i});
        else mx.insert({d[i].back(), i});
    }
    for (int i=0; i<N; i++)
    {
        if (mx.find({i, C[i]})!=mx.end())
        {
            d[C[i]].pop_back();
            mx.erase({i, C[i]});
        }
        else
        {
            auto col=prev(mx.end())->second;
            mx.erase(prev(mx.end()));
            d[C[i]].pop_back();
            idx[C[i]]=idx[col];
            for (int j=0; j<bits; j++) WriteAdvice(idx[C[i]]&(1<<j)); 
            //cout<<"remove "<<C[i]<<' '<<idx[C[i]]<<'\n';
        }
        if (d[C[i]].empty()) mx.insert({1e9, C[i]});
        else mx.insert({d[C[i]].back(), C[i]});
    }
}
#include "assistant.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e5+5;

int c[nx], bit, t;
set<int> s;

void Assist(unsigned char *A, int N, int K, int R) {
    bit=ceil(log2(K));
    for (int i=0; i<K; i++) c[i]=i, s.insert(i);
    for (int i=0; i<N; i++)
    {
        auto cur=GetRequest();
        if (s.find(cur)!=s.end()) continue;
        int tmp=0;
        for (int j=0; j<bit; j++) if (A[t++]==1) tmp+=(1<<j);
        s.erase(c[tmp]);
        PutBack(c[tmp]);
        s.insert(cur);
        c[tmp]=cur;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3616 KB Output is correct
2 Incorrect 1 ms 3616 KB Error - advice must be 0 or 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3932 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 7160 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3644 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 8036 KB Error - advice must be 0 or 1
2 Incorrect 19 ms 8020 KB Error - advice must be 0 or 1
3 Incorrect 22 ms 8432 KB Error - advice must be 0 or 1
4 Incorrect 19 ms 8200 KB Error - advice must be 0 or 1
5 Incorrect 19 ms 8380 KB Error - advice must be 0 or 1
6 Incorrect 17 ms 8304 KB Error - advice must be 0 or 1
7 Incorrect 18 ms 8288 KB Error - advice must be 0 or 1
8 Incorrect 17 ms 8308 KB Error - advice must be 0 or 1
9 Incorrect 18 ms 8296 KB Error - advice must be 0 or 1
10 Incorrect 22 ms 9232 KB Error - advice must be 0 or 1