답안 #871631

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871631 2023-11-11T08:12:29 Z Matjaz 최후의 만찬 (IOI12_supper) C++14
8 / 100
2500 ms 70680 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[C[i]].pop();
        if (scafold.count(C[i]) > 0) continue;
        
        int besttime = -1;
        int bestcolour = -1;
        
        for (set<int>::iterator it = scafold.begin(); it != scafold.end(); it++){
            
            int u = *it;
            if (Q[u].empty() || Q[u].front() > besttime){
                besttime = Q[u].empty() ? N : Q[u].front();
                bestcolour = u;
            }
        }
        
        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 800 KB Output is correct
2 Correct 0 ms 1040 KB Output is correct
3 Correct 1 ms 1564 KB Output is correct
4 Correct 7 ms 2932 KB Output is correct
5 Correct 12 ms 4308 KB Output is correct
6 Correct 13 ms 4284 KB Output is correct
7 Correct 5 ms 4184 KB Output is correct
8 Correct 33 ms 4568 KB Output is correct
9 Correct 29 ms 4272 KB Output is correct
10 Correct 28 ms 4460 KB Output is correct
11 Correct 25 ms 4440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 8104 KB Output is correct
2 Correct 1211 ms 38012 KB Output is correct
3 Execution timed out 2551 ms 70680 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2523 ms 56476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 3632 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2552 ms 70044 KB Time limit exceeded
2 Execution timed out 2558 ms 70096 KB Time limit exceeded
3 Execution timed out 2536 ms 70192 KB Time limit exceeded
4 Execution timed out 2548 ms 70460 KB Time limit exceeded
5 Execution timed out 2539 ms 70368 KB Time limit exceeded
6 Execution timed out 2554 ms 70228 KB Time limit exceeded
7 Execution timed out 2553 ms 70284 KB Time limit exceeded
8 Execution timed out 2535 ms 70484 KB Time limit exceeded
9 Execution timed out 2537 ms 70032 KB Time limit exceeded
10 Execution timed out 2531 ms 70312 KB Time limit exceeded