답안 #1023019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023019 2024-07-14T08:45:19 Z boyliguanhan 최후의 만찬 (IOI12_supper) C++17
0 / 100
80 ms 7124 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);
    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(A[i])passive.insert(x);
        if(on[x]) continue;
        int die=*passive.begin();
        PutBack(die);
        on[die]=0;on[x]=1;
        passive.erase(die);
    }
}

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);
      |         ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 796 KB Output is correct
2 Incorrect 1 ms 784 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1424 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 80 ms 5664 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1340 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 6812 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 60 ms 6736 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 75 ms 7124 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 65 ms 6984 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 62 ms 7056 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 63 ms 6976 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 63 ms 6984 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 60 ms 7020 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 67 ms 6972 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 52 ms 6632 KB Error - Putting back a color that is not on the scaffold