Submission #744025

# Submission time Handle Problem Language Result Execution time Memory
744025 2023-05-18T07:20:31 Z boyliguanhan Last supper (IOI12_supper) C++17
Compilation error
0 ms 0 KB
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {

  priority_queue<pair<int, int>> q;
  int last[N], nxt[N];
  memset(last, 1, sizeof last);
  int C[N], bits = log2(K);
  for(int i = 0; i < N; i++)
    for(int j = 0; j < bits; j++)
      C[i]|=A[i*bits+j]-'0' << j;
  for(int i = N; i--;)
    nxt[i] = last[C[i]], last[C[i]] = i;
  bool on[N];
  memset(on, 0, sizeof on);
  for(int i = 0; i < K; i++)
    q.push({last[i], i}), on[i] = 1;
  for(int i = 0; i < N; i++) {
    int col = GetRequest();
    if(!on[col]) {
      PutBack(q.top().second);
      on[q.top().second] = 0;
      q.pop();
      q.push({nxt[i], i});
      on[col] = 1;
    }
  }
}



    

Compilation message

advisor.cpp: In function 'void Assist(unsigned char*, int, int, int)':
advisor.cpp:13:24: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   13 |       C[i]|=A[i*bits+j]-'0' << j;
      |             ~~~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccA2fvxX.o: in function `Assist(unsigned char*, int, int, int)':
advisor.cpp:(.text+0x3a2): undefined reference to `GetRequest()'
/usr/bin/ld: advisor.cpp:(.text+0x3b9): undefined reference to `PutBack(int)'
/usr/bin/ld: /tmp/ccnwOA4X.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/ccVDx8CJ.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