답안 #632755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632755 2022-08-20T17:31:34 Z Iwanttobreakfree 최후의 만찬 (IOI12_supper) C++17
0 / 100
368 ms 18896 KB
#include "advisor.h"
#include <vector>
#include <set>
#include <cmath>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    int logn=log(N)+1;
    for(int i=0;i<N;i++){
        int x=C[i];
        for(int j=0;j<logn;j++){
            if(x&1)WriteAdvice(1);
            else WriteAdvice(0);
            x/=2;
        }
    }
}
#include "assistant.h"
#include <vector>
#include <set>
#include <cmath>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
      int logn=log(N)+1;
      vector<int> V(N),cnt(N);
      set<int> S;
      set<pair<int,int>> M;
      for(int i=0;i<K;i++)S.insert(i);
      for(int i=0;i<N;i++){
        for(int j=logn-1;j>=0;j--){
            V[i]*=2;
            V[i]+=(int)(A[i*logn+j]);
        }
      }
      vector<vector<int>> needed(N,vector<int>());
      for(int i=0;i<N;i++){
        needed[V[i]].push_back(i);
      }
      for(int i=0;i<N;i++)needed[i].push_back(N);
      for(int i=0;i<K;i++){
        M.insert({-needed[i][0],i});
      }
      for (int i = 0; i < N; i++) {
        int req = GetRequest();
        if (S.find(req)==S.end()){
            auto it=M.begin();
            S.erase(it->second);
            S.insert(req);
            PutBack(it->second);
            M.erase(it);
            cnt[req]++;
            M.insert({-needed[req][cnt[req]],req});
        }
        else{
            M.erase({-needed[req][cnt[req]],req});
            cnt[req]++;
            M.insert({-needed[req][cnt[req]],req});
        }
      }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 508 KB Output is correct
2 Incorrect 0 ms 512 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 2108 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 264 ms 15224 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 508 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 333 ms 18452 KB Output isn't correct - not an optimal way
2 Incorrect 318 ms 18604 KB Output isn't correct - not an optimal way
3 Incorrect 366 ms 18868 KB Output isn't correct - not an optimal way
4 Incorrect 320 ms 18896 KB Output isn't correct - not an optimal way
5 Incorrect 320 ms 18876 KB Output isn't correct - not an optimal way
6 Incorrect 341 ms 18828 KB Output isn't correct - not an optimal way
7 Incorrect 316 ms 18752 KB Output isn't correct - not an optimal way
8 Incorrect 356 ms 18888 KB Output isn't correct - not an optimal way
9 Incorrect 316 ms 18716 KB Output isn't correct - not an optimal way
10 Incorrect 368 ms 18840 KB Output isn't correct - not an optimal way