Submission #1038002

# Submission time Handle Problem Language Result Execution time Memory
1038002 2024-07-29T12:01:13 Z idas Last supper (IOI12_supper) C++11
0 / 100
57 ms 7296 KB
#include <bits/stdc++.h>
#include "advisor.h"

#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define s second
#define f first

using namespace std;
typedef pair<int, int> pii;

namespace advisor{
    const int MxN=1e5+10;
    int n, k, c[MxN], nxt[MxN], cur[MxN], id[MxN];
    unsigned char bits[MxN];
}

using namespace advisor;

void ComputeAdvice(int *C, int N, int K, int M) {
    n=N; k=K; FOR(i, 0, n) c[i]=C[i], cur[i]=-1;
    for(int i=n-1; i>=0; i--){
        nxt[i+k]=cur[c[i]];
        cur[c[i]]=i;
    }
    FOR(i, 0, k) nxt[i]=cur[i], id[i]=i;
    FOR(i, 0, n+k) bits[i]=0;

    set<pii, greater<pii>> st;
    FOR(i, 0, k) st.insert({nxt[i],i});

    FOR(i, 0, n)
    {
        auto it=st.begin();
        int in=(*it).s;
        st.erase(it);

        int col;
        if(in<k) col=in;
        else col=c[in-k];

        if(c[i]!=col) bits[in]=1;

        st.insert({nxt[i+k], i+k});
    }

    FOR(i, 0, n+k) WriteAdvice(bits[i]);

//    FOR(i, 0, n+k) cout << bits[i];
//    cout << endl;
}
#include <bits/stdc++.h>
#include "assistant.h"

#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define pb push_back
#define s second
#define f first

using namespace std;
typedef vector<int> vi;

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

    vi bad;
    set<int> cols;
    FOR(i, 0, k)
    {
        cols.insert(i);
        if(bits[i]==1) bad.pb(i);
    }

//    FOR(i, 0, n+k) cout << bits[i];
//    cout << endl;

//    cout << "bad: ";
//    for(auto it : bad) cout << it << " ";
//    cout << endl;

    FOR(i, k, n+k)
    {
        int next_col=GetRequest();
        if(!cols.count(next_col)){
            cols.erase(bad.back());
            PutBack(bad.back());
            bad.pop_back();

            cols.insert(next_col);
            if(bits[i]==1) bad.pb(next_col);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1132 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 6072 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1076 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 6728 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 50 ms 7008 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 55 ms 7296 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 54 ms 7176 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 53 ms 7196 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 47 ms 7176 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 52 ms 7296 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 47 ms 7284 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 50 ms 7224 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 50 ms 7124 KB Error - Putting back a color that is not on the scaffold