Submission #860441

# Submission time Handle Problem Language Result Execution time Memory
860441 2023-10-13T02:34:19 Z nguyentunglam Last supper (IOI12_supper) C++17
0 / 100
296 ms 19104 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
  int T = log2(N) + 1;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < T; j++) WriteAdvice(C[i] >> j & 1);
  }
}
#include "assistant.h"

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int query[N];

bool chosen[N];

vector<int> nxt[N];

void Assist(unsigned char *A, int N, int K, int R) {
  int T = log2(N) + 1;
  int cnt = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < T; j++) {
      if (int(A[cnt])) query[i] |= (1 << j);
      cnt++;
    }
  }

  for(int i = N - 1; i >= 0; i--) nxt[query[i]].push_back(i);

  priority_queue<pair<int, int> > Q;
  for(int i = 0; i < K; i++) {
    int tmp = nxt[i].empty() ? N : nxt[i].back();
    Q.push({tmp, i});
    chosen[i] = 1;
  }

  for(int i = 0; i < N; i++) {
    GetRequest();
    int x = query[i];
//    if (chosen[x] == 0) {
//      if (Q.empty()) return;
//      int useless, j; tie(useless, j) = Q.top(); Q.pop();
//      chosen[j] = 0;
//      PutBack(j);
//
//      chosen[x] = 1;
//      if (nxt[x].empty()) return;
//      nxt[x].pop_back();
//      int tmp = nxt[x].empty() ? N : nxt[i].back();
//      Q.push({tmp, x});
//    }
  }
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:34:9: warning: unused variable 'x' [-Wunused-variable]
   34 |     int x = query[i];
      |         ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3100 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4452 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 219 ms 15548 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3092 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 285 ms 17956 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 274 ms 18096 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 269 ms 18192 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 275 ms 18120 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 267 ms 18152 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 273 ms 18632 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 268 ms 18140 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 296 ms 18012 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 268 ms 18096 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 269 ms 19104 KB Error - Not putting back color when it is not on the scaffold