답안 #871644

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871644 2023-11-11T08:24:09 Z Matjaz 최후의 만찬 (IOI12_supper) C++14
0 / 100
314 ms 78432 KB
#include "advisor.h"

#include<set>
#include<queue>
#include<vector>

using namespace std;

int L;

void writeInt(int x){
    for (int i=0;i<L;i++){
        WriteAdvice(x % 2);
        x /= 2;
    }
}

void ComputeAdvice(int *C, int N, int K, int M) {
    
    for (L=0;L<31;L++){
        if ((1<<L) > N) break;
    }
    
    set<int> scafold;
    for (int i=0;i<K;i++) scafold.insert(i);
    vector<queue<int> > Q(N);
    for (int i=0;i<N;i++) Q[C[i]].push(i);
    for (int i=0;i<N;i++) Q[i].push(N);
    
    priority_queue<pair<int,int> > choice;
    for (int i=0;i<K;i++){
        choice.push(make_pair(Q[i].front(), i));
    }
    
    
    for (int i=0;i<N;i++){
        Q[C[i]].pop();
        if (scafold.count(C[i]) > 0) continue;
        
        int bestcolour = choice.top().second;
        choice.pop();
        choice.push(make_pair(Q[C[i]].front(), C[i]));
        writeInt(bestcolour);
        scafold.erase(bestcolour);
        scafold.insert(C[i]);
    }
}
#include "assistant.h"


#include<queue>
#include<set>

using namespace std;




void Assist(unsigned char *A, int N, int K, int R) {
    
    int L;
    for (L=0;L<31;L++){
        if ((1<<L) > N) break;
    }
    
    queue<int> Q;
    for (int i=0;i< R / L;i++){
        int x = 0;
        for (int j=0;j<L;j++) x += (1<<j) * A[i * L + j];
        Q.push(x);
    }
    
    set<int> scafold;
    for (int i=0;i<K;i++) scafold.insert(i);
    
    for (int i=0;i<N;i++){
        int req = GetRequest();
        if (scafold.count(req) > 0) continue;
        PutBack(Q.front());
        scafold.erase(Q.front());
        scafold.insert(req);
        Q.pop();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 796 KB Output is correct
2 Incorrect 1 ms 784 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 8240 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 217 ms 62540 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3632 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 286 ms 77972 KB Output isn't correct - not an optimal way
2 Incorrect 275 ms 77404 KB Output isn't correct - not an optimal way
3 Incorrect 266 ms 77484 KB Output isn't correct - not an optimal way
4 Incorrect 262 ms 77352 KB Output isn't correct - not an optimal way
5 Incorrect 269 ms 77696 KB Output isn't correct - not an optimal way
6 Incorrect 266 ms 77236 KB Output isn't correct - not an optimal way
7 Incorrect 264 ms 77296 KB Output isn't correct - not an optimal way
8 Incorrect 264 ms 77368 KB Output isn't correct - not an optimal way
9 Incorrect 264 ms 77428 KB Output isn't correct - not an optimal way
10 Correct 314 ms 78432 KB Output is partially correct - 1266636 bits used