Submission #632752

# Submission time Handle Problem Language Result Execution time Memory
632752 2022-08-20T17:27:58 Z Iwanttobreakfree Last supper (IOI12_supper) C++17
9 / 100
477 ms 25424 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;
        }
    }
}
#include "assistant.h"
#include <vector>
#include <set>
using namespace std;
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;i++){
        for(int j=19;j>=0;j--){
            V[i]*=2;
            V[i]+=(int)(A[i*20+j]);
        }
      }
      vector<vector<int>> needed(N,vector<int>());
      for(int i=0;i<N;i++){
        needed[V[i]].push_back(i);
      }
      for(int i=0;i<N;i++)needed[i].push_back(N);
      for(int i=0;i<K;i++){
        M.insert({-needed[i][0],i});
      }
      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});
        }
      }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 516 KB Output is correct
2 Correct 2 ms 516 KB Output is correct
3 Correct 5 ms 808 KB Output is correct
4 Correct 12 ms 1124 KB Output is correct
5 Incorrect 1 ms 660 KB Error - advice is too long
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 2704 KB Output is correct
2 Correct 230 ms 11820 KB Output is correct
3 Correct 464 ms 25424 KB Output is correct
4 Correct 454 ms 22008 KB Output is correct
5 Correct 440 ms 22024 KB Output is correct
6 Correct 427 ms 22832 KB Output is correct
7 Correct 477 ms 23736 KB Output is correct
8 Correct 382 ms 21000 KB Output is correct
9 Correct 390 ms 22024 KB Output is correct
10 Correct 477 ms 24676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2288 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 508 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2688 KB Error - advice is too long
2 Incorrect 18 ms 2688 KB Error - advice is too long
3 Incorrect 19 ms 2672 KB Error - advice is too long
4 Incorrect 20 ms 2620 KB Error - advice is too long
5 Incorrect 20 ms 2680 KB Error - advice is too long
6 Incorrect 24 ms 2708 KB Error - advice is too long
7 Incorrect 21 ms 2684 KB Error - advice is too long
8 Incorrect 20 ms 2668 KB Error - advice is too long
9 Incorrect 19 ms 2552 KB Error - advice is too long
10 Incorrect 19 ms 2736 KB Error - advice is too long