Submission #860437

# Submission time Handle Problem Language Result Execution time Memory
860437 2023-10-13T02:32:12 Z nguyentunglam Last supper (IOI12_supper) C++17
Compilation error
0 ms 0 KB
#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

/usr/bin/ld: /tmp/ccxbidC5.o: in function `Assist(unsigned char*, int, int, int)':
advisor.cpp:(.text+0x301): undefined reference to `PutBack(int)'
/usr/bin/ld: advisor.cpp:(.text+0x397): undefined reference to `GetRequest()'
/usr/bin/ld: /tmp/ccM2qf65.o: in function `main':
advisor_grader.cpp:(.text.startup+0xe6): undefined reference to `ComputeAdvice(int*, int, int, int)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccP9MaSS.o: in function `main':
assistant_grader.cpp:(.text.startup+0x21e): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status