Submission #805324

# Submission time Handle Problem Language Result Execution time Memory
805324 2023-08-03T15:17:18 Z aymanrs Last supper (IOI12_supper) C++14
43 / 100
190 ms 13332 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] = true;
    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 0 ms 516 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 1 ms 640 KB Output is correct
4 Correct 2 ms 648 KB Output is correct
5 Correct 2 ms 812 KB Output is correct
6 Correct 6 ms 996 KB Output is correct
7 Correct 3 ms 820 KB Output is correct
8 Correct 7 ms 1016 KB Output is correct
9 Correct 7 ms 1016 KB Output is correct
10 Correct 7 ms 980 KB Output is correct
11 Correct 7 ms 1000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1372 KB Output is correct
2 Correct 54 ms 4700 KB Output is correct
3 Correct 163 ms 12768 KB Output is correct
4 Correct 103 ms 8920 KB Output is correct
5 Correct 186 ms 10968 KB Output is correct
6 Correct 159 ms 11332 KB Output is correct
7 Correct 149 ms 11112 KB Output is correct
8 Correct 156 ms 11356 KB Output is correct
9 Correct 82 ms 7600 KB Output is correct
10 Correct 136 ms 10888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 117 ms 7880 KB Output is correct
2 Correct 141 ms 10952 KB Output is correct
3 Correct 142 ms 10836 KB Output is correct
4 Correct 132 ms 10476 KB Output is correct
5 Correct 109 ms 9044 KB Output is correct
6 Correct 154 ms 10984 KB Output is correct
7 Correct 142 ms 10636 KB Output is correct
8 Correct 185 ms 13332 KB Output is correct
9 Correct 89 ms 8908 KB Output is correct
10 Correct 137 ms 10892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 616 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 152 ms 9896 KB Output is partially correct - 772365 bits used
2 Correct 144 ms 9728 KB Output is partially correct - 742095 bits used
3 Correct 146 ms 9652 KB Output is partially correct - 712470 bits used
4 Correct 138 ms 9640 KB Output is partially correct - 712005 bits used
5 Correct 139 ms 9656 KB Output is partially correct - 710610 bits used
6 Correct 138 ms 9684 KB Output is partially correct - 712155 bits used
7 Correct 145 ms 9764 KB Output is partially correct - 711090 bits used
8 Correct 138 ms 9748 KB Output is partially correct - 713340 bits used
9 Correct 153 ms 9624 KB Output is partially correct - 712830 bits used
10 Correct 190 ms 12152 KB Output is partially correct - 1117620 bits used