Submission #804415

# Submission time Handle Problem Language Result Execution time Memory
804415 2023-08-03T08:35:26 Z Dan4Life Last supper (IOI12_supper) C++17
0 / 100
39 ms 2784 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	for(int i = 0; i < N; i++)
		for(int j = 0; j < 20; j++)
			WriteAdvice((C[i]>>j)&1);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
 
void Assist(unsigned char *A, int N, int K, int R) {
 
  int C[N+1]; vector<int> v[N+1];
  for(int i = 0; i < N; i++) C[i]=0;
  for(int i = 0; i < R; i++)
	  C[i/20] |= (1<<(i%20))*A[i];
  set<int> S; set<pair<int,int>> SS;
  for(int i = 0; i < N; i++) v[C[i]].push_back(i);
  for(int i = 0; i < N; i++) v[i].push_back(N);
  for(int i = 0; i < K; i++){
	  int nx = *upper_bound(begin(v[i]),end(v[i]),-1);
	  S.insert(i); SS.insert({nx,i});
  }
  for(int i = 0; i < N; i++) {
    int req = GetRequest();
    if(S.count(req)){
		int nx = *upper_bound(begin(v[req]),end(v[req]),i);
		SS.erase(--end(SS)); SS.insert({nx,req});
		continue;
	}
    int getCol = (--end(SS))->second;
    S.erase(getCol); S.insert(req); PutBack(getCol);
    int nx = *upper_bound(begin(v[req]),end(v[req]),i);
    SS.erase(--end(SS)); SS.insert({nx,req});
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 512 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 2636 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 2320 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 13 ms 2704 KB Error - advice is too long
2 Incorrect 14 ms 2732 KB Error - advice is too long
3 Incorrect 13 ms 2688 KB Error - advice is too long
4 Incorrect 13 ms 2680 KB Error - advice is too long
5 Incorrect 13 ms 2636 KB Error - advice is too long
6 Incorrect 13 ms 2700 KB Error - advice is too long
7 Incorrect 14 ms 2704 KB Error - advice is too long
8 Incorrect 14 ms 2772 KB Error - advice is too long
9 Incorrect 13 ms 2784 KB Error - advice is too long
10 Incorrect 13 ms 2764 KB Error - advice is too long