답안 #118573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118573 2019-06-19T09:08:16 Z win11905 최후의 만찬 (IOI12_supper) C++11
0 / 100
380 ms 149488 KB
#include <bits/stdc++.h>
#include "advisor.h"
#define pii pair<int, int>
#define x first
#define y second
using namespace std;

const int N = 1e5+5;

static queue<int> pos[N];
static bool inq[N];

void ComputeAdvice(int *C, int N, int K, int M) {
  int bt = log2(N);
  for(int i = 0; i < N; ++i) pos[C[i]].emplace(i);
  for(int i = 0; i < N; ++i) pos[i].emplace(N);
  set<pii, greater<pii> > Q;
  for(int i = 0; i < K; ++i) Q.emplace(pos[i].front(), i), inq[i] = true;
  for(int i = 0; i < N; ++i) {
    if(inq[C[i]]) {
      Q.erase(pii(pos[C[i]].front(), i));
    } else {
      int v = Q.begin()->y; Q.erase(Q.begin());
      inq[v] = false, inq[C[i]] = true;
      for(int i = 0; i < bt; ++i) WriteAdvice(v >> i & 1);
    } 
    pos[C[i]].pop();
    Q.emplace(pos[C[i]].front(), C[i]);
  }
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std; 

void Assist(unsigned char *A, int N, int K, int R) {
  int bt = log2(N);
  set<int> S; 
  for(int i = 0; i < K; ++i) S.emplace(i);
  int ptr = 0;
  for(int i = 0; i < N; ++i) {
    int v;
    if(S.count(v = GetRequest())) continue;
    int val = 0;
    for(int i = 0; i < bt; ++i) if(A[ptr++]) val |= (1 << i);
    PutBack(val);
    S.erase(val);
    S.emplace(v);
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 135416 KB Output is correct
2 Incorrect 75 ms 135240 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 84 ms 136432 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 272 ms 146400 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 64 ms 135408 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 327 ms 148728 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 330 ms 148976 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 339 ms 149488 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 327 ms 149232 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 330 ms 149232 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 320 ms 149232 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 324 ms 149232 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 326 ms 149488 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 324 ms 149232 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 380 ms 149232 KB Error - Putting back a color that is not on the scaffold