답안 #805310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805310 2023-08-03T15:02:17 Z aymanrs 최후의 만찬 (IOI12_supper) C++14
0 / 100
202 ms 13372 KB
#include <bits/stdc++.h>
using namespace std;
#include "advisor.h"
void ComputeAdvice(int *C, int N, int K, int M) {
  int L;
  L = log2(K)+1;
  set<pair<int, int>> q;
  int s[N], nx[N];
  bool f[N] = {false};
  fill(s, s+N, N);
  int c[N];
  for(int i = N-1;i >= 0;i--) {
    nx[i] = s[C[i]];
    s[C[i]] = i;
  }
  for(int i = 0;i < K;i++){
    q.insert({s[i], i});
    f[i] = i;
    c[i] = i;
  }
  for(int i = 0;i < N;i++){
    if(f[C[i]]) {
      int ind = q.begin()->second;
      q.erase(q.begin());
      q.insert({nx[i], ind});
      continue;
    }
    int ind = q.rbegin()->second;
    for(int b = 0;b < L;b++) WriteAdvice(1&(ind>>b));
    f[c[ind]] = false;
    f[C[i]] = true;
    c[ind] = C[i];
    q.erase(prev(q.end()));
    q.insert({nx[i], ind});
  }
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
  int L;
  L = log2(K)+1;
  int c[N];
  bool f[N] = {false};
  for(int i = 0;i < K;i++){
    f[i] = true;
    c[i] = i;
  }
  int cur = 0;
  for(int i = 0;i < N;i++){
    int r = GetRequest();
    if(f[r]) continue;
    int ind = 0;
    for(int b = 0;b < L;b++) {
      if(A[cur]) ind |= 1 << b;
      cur++;
    }
    PutBack(c[ind]);
    f[r] = true;
    f[c[ind]] = false;
    c[ind] = r;
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Incorrect 1 ms 512 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 1404 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 116 ms 10524 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 760 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 162 ms 13328 KB Execution killed with signal 11
2 Runtime error 165 ms 13372 KB Execution killed with signal 11
3 Runtime error 173 ms 13304 KB Execution killed with signal 11
4 Correct 139 ms 10848 KB Output is partially correct - 712005 bits used
5 Runtime error 151 ms 13208 KB Execution killed with signal 11
6 Correct 142 ms 10792 KB Output is partially correct - 712155 bits used
7 Runtime error 158 ms 13240 KB Execution killed with signal 11
8 Runtime error 142 ms 12796 KB Execution killed with signal 11
9 Correct 141 ms 10852 KB Output is partially correct - 712830 bits used
10 Correct 202 ms 13276 KB Output is partially correct - 1117635 bits used