Submission #805316

# Submission time Handle Problem Language Result Execution time Memory
805316 2023-08-03T15:06:43 Z aymanrs Last supper (IOI12_supper) C++14
0 / 100
184 ms 12280 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)+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)+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;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 516 KB Output is correct
2 Incorrect 0 ms 508 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1324 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 117 ms 9584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 648 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 156 ms 12252 KB Execution killed with signal 11
2 Runtime error 161 ms 12280 KB Execution killed with signal 11
3 Runtime error 153 ms 12036 KB Execution killed with signal 11
4 Correct 139 ms 9664 KB Output is partially correct - 712005 bits used
5 Runtime error 165 ms 11980 KB Execution killed with signal 11
6 Correct 139 ms 9656 KB Output is partially correct - 712155 bits used
7 Runtime error 154 ms 12084 KB Execution killed with signal 11
8 Runtime error 145 ms 11796 KB Execution killed with signal 11
9 Correct 153 ms 9732 KB Output is partially correct - 712830 bits used
10 Correct 184 ms 12172 KB Output is partially correct - 1117635 bits used