Submission #1023040

# Submission time Handle Problem Language Result Execution time Memory
1023040 2024-07-14T08:54:04 Z boyliguanhan Last supper (IOI12_supper) C++17
0 / 100
103 ms 7892 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>onf;
void ComputeAdvice(int *C, int N, int K, int M) {
    vector<int>nxt(N),lst(N,N),plat(K),dead(N+K,N-1);
    iota(plat.begin(),plat.end(),0);
    C[N]=N+5;
    for(int i=N;i--;)
        nxt[i]=lst[C[i]],
        lst[C[i]]=i;
    set<pair<int,int>> st;
    for(auto i:plat)onf[i]=1,
        st.insert({lst[i],i+N});
    int df=log2(2*K-1);
    for(int i=0;i<N;i++){
        if(onf[C[i]]){
            auto [x,y]=*st.lower_bound({i,0});
            st.erase({x,y});
            st.insert({nxt[i],y});
            continue;
        }
        onf[C[i]]=1;
        auto[x,y]=*--st.end();
        dead[y]=i;
        st.erase({x,y});
        st.insert({nxt[i],i});
        onf[C[x]]=0;
    }
    for(int i=0;i<K;i++)
        nxt.push_back(lst[i]);
    for(int i=0;i<N+K;i++)
        WriteAdvice(dead[i]<nxt[i]);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>on;
void Assist(unsigned char *A, int N, int K, int R) {
    set<int>passive;
    for(int i=0;i<K;on[i]=1,i++)
        if(A[N+i])
            passive.insert(i);
    for(int i=0;i<N;i++){
        int x=GetRequest();
        if(on[x]) { if(A[i])
                passive.insert(x);
            continue;
        }
        int die=*passive.begin();
        PutBack(die);
        on[die]=0;on[x]=1;
        passive.erase(die);
        if(A[i])passive.insert(x);
    }
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:15:9: warning: unused variable 'df' [-Wunused-variable]
   15 |     int df=log2(2*K-1);
      |         ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 784 KB Output is correct
2 Correct 0 ms 876 KB Output is correct
3 Correct 1 ms 792 KB Output is correct
4 Incorrect 2 ms 916 KB Error - Putting back a color that is not on the scaffold
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1424 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 6380 KB Output is correct
2 Correct 89 ms 7704 KB Output is correct
3 Correct 98 ms 7768 KB Output is correct
4 Correct 93 ms 7676 KB Output is correct
5 Incorrect 80 ms 6876 KB Error - Putting back a color that is not on the scaffold
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 960 KB Output is correct
2 Correct 3 ms 1120 KB Output is correct
3 Incorrect 5 ms 968 KB Error - Putting back a color that is not on the scaffold
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 6752 KB Error - Putting back a color that is not on the scaffold
2 Correct 84 ms 7500 KB Output is correct - 122000 bits used
3 Correct 79 ms 7892 KB Output is correct - 125000 bits used
4 Correct 83 ms 7792 KB Output is correct - 125000 bits used
5 Correct 103 ms 7732 KB Output is correct - 125000 bits used
6 Correct 72 ms 7736 KB Output is correct - 125000 bits used
7 Correct 71 ms 7648 KB Output is correct - 124828 bits used
8 Correct 76 ms 7736 KB Output is correct - 124910 bits used
9 Correct 70 ms 7772 KB Output is correct - 125000 bits used
10 Incorrect 49 ms 6516 KB Error - Putting back a color that is not on the scaffold