Submission #632756

# Submission time Handle Problem Language Result Execution time Memory
632756 2022-08-20T17:34:04 Z Iwanttobreakfree Last supper (IOI12_supper) C++17
8 / 100
345 ms 19676 KB
#include "advisor.h"
#include <vector>
#include <set>
#include <cmath>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    int logn=13;
    for(int i=0;i<N;i++){
        int x=C[i];
        for(int j=0;j<logn;j++){
            if(x&1)WriteAdvice(1);
            else WriteAdvice(0);
            x/=2;
        }
    }
}
#include "assistant.h"
#include <vector>
#include <set>
#include <cmath>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
      int logn=13;
      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=logn-1;j>=0;j--){
            V[i]*=2;
            V[i]+=(int)(A[i*logn+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 508 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 3 ms 672 KB Output is correct
4 Correct 9 ms 992 KB Output is correct
5 Correct 14 ms 1300 KB Output is correct
6 Correct 15 ms 1356 KB Output is correct
7 Correct 14 ms 1428 KB Output is correct
8 Correct 15 ms 1444 KB Output is correct
9 Correct 15 ms 1432 KB Output is correct
10 Correct 15 ms 1624 KB Output is correct
11 Correct 16 ms 1456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 2364 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 15636 KB Output isn't correct - not an optimal way
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 320 ms 18980 KB Output isn't correct - not an optimal way
2 Incorrect 327 ms 19072 KB Output isn't correct - not an optimal way
3 Incorrect 332 ms 19348 KB Output isn't correct - not an optimal way
4 Incorrect 345 ms 19564 KB Output isn't correct - not an optimal way
5 Incorrect 330 ms 19588 KB Output isn't correct - not an optimal way
6 Incorrect 328 ms 19376 KB Output isn't correct - not an optimal way
7 Incorrect 332 ms 19676 KB Output isn't correct - not an optimal way
8 Incorrect 330 ms 19356 KB Output isn't correct - not an optimal way
9 Incorrect 331 ms 19536 KB Output isn't correct - not an optimal way
10 Incorrect 330 ms 19284 KB Output isn't correct - not an optimal way