Submission #632736

# Submission time Handle Problem Language Result Execution time Memory
632736 2022-08-20T17:10:45 Z Iwanttobreakfree Last supper (IOI12_supper) C++17
Compilation error
0 ms 0 KB
#include "advisor.h"
#include <vector>
#include <set>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    for(int i=0;i<N;i++){
        int x=C[i];
        for(int j=0;j<20;j++){
            if(x&1)WriteAdvice(1);
            else WriteAdvice(0);
            x/=2;
        }
    }
}
void Assist(vector<char>& A, int N, int K, int R) {
      vector<int> V(N),cnt(N);
      set<int> S;
      set<pair<int,int>> M;
      for(int i=0;i<K;i++)S.insert(i);
      for(int i=0;i<N*20;i+=20){
        for(int j=19;j>=0;j--){
            V[i/20]*=2;
            V[i/20]+=A[i+j]-'0';
        }
      }
      vector<vector<int>> needed(N,vector<int>());
      for(int i=0;i<N;i++)needed[V[i]].push_back(i);
  		return;
      for(int i=0;i<N;i++)needed[i].push_back(N);
      for(int i=0;i<K;i++){
        M.insert({-needed[i].back(),i});
      }
      return;
      for (int i = 0; i < N; i++) {
        int req = GetRequest();
        if (S.find(req)==S.end()){
            auto it=M.begin();
            S.erase(it->second);
            S.insert(req);
            PutBack(it->second);
            M.erase(it);
            cnt[req]++;
            M.insert({-needed[req][cnt[req]],req});
        }
        else{
            M.erase({-needed[req][cnt[req]],req});
            cnt[req]++;
            M.insert({-needed[req][cnt[req]],req});
        }
      }
}

Compilation message

assistant.cpp:1:6: error: variable or field 'Assist' declared void
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |      ^~~~~~
assistant.cpp:1:13: error: 'vector' was not declared in this scope
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |             ^~~~~~
assistant.cpp:1:20: error: expected primary-expression before 'char'
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |                    ^~~~
assistant.cpp:1:30: error: expected primary-expression before 'int'
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |                              ^~~
assistant.cpp:1:37: error: expected primary-expression before 'int'
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |                                     ^~~
assistant.cpp:1:44: error: expected primary-expression before 'int'
    1 | void Assist(vector<char>& A, int N, int K, int R) {
      |                                            ^~~