Submission #632718

#TimeUsernameProblemLanguageResultExecution timeMemory
632718IwanttobreakfreeLast supper (IOI12_supper)C++17
Compilation error
0 ms0 KiB
//#include "assistant.h" #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(unsigned 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[i].push_back(N); for(int i=N-1;i>=0;i++)needed[V[i]].push_back(i); for(int i=0;i<K;i++){ M.insert({-needed[i].back(),i}); } for(int i=0;i<N;i++)cnt[i]=needed[i].size()-1; 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}); } } }
#include "assistant.h" //#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(unsigned 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[i].push_back(N); for(int i=N-1;i>=0;i++)needed[V[i]].push_back(i); for(int i=0;i<K;i++){ M.insert({-needed[i].back(),i}); } for(int i=0;i<N;i++)cnt[i]=needed[i].size()-1; 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 (stderr)

advisor.cpp: In function 'void Assist(unsigned char*, int, int, int)':
advisor.cpp:36:19: error: 'GetRequest' was not declared in this scope
   36 |         int req = GetRequest();
      |                   ^~~~~~~~~~
advisor.cpp:41:13: error: 'PutBack' was not declared in this scope
   41 |             PutBack(it->second);
      |             ^~~~~~~

assistant.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
assistant.cpp:11:20: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   11 |             if(x&1)WriteAdvice(1);
      |                    ^~~~~~~~~~~
      |                    ComputeAdvice
assistant.cpp:12:18: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   12 |             else WriteAdvice(0);
      |                  ^~~~~~~~~~~
      |                  ComputeAdvice