Submission #804460

# Submission time Handle Problem Language Result Execution time Memory
804460 2023-08-03T08:51:30 Z Dan4Life Last supper (IOI12_supper) C++17
17 / 100
444 ms 24568 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	int x = *max_element(C,C+N);
	for(int i = 0; i < N; i++)
		for(int j = 0; j < (x<5000?13: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;
  const int bit = (R==13*N)?13:20;
  for(int i = 0; i < R; i++)
      if(A[i]) C[i/bit] |= (1<<(i%bit));
  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+1);
  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({i,req}); 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 Correct 1 ms 528 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 5 ms 796 KB Output is correct
4 Correct 8 ms 980 KB Output is correct
5 Correct 14 ms 1312 KB Output is correct
6 Correct 16 ms 1332 KB Output is correct
7 Correct 13 ms 1460 KB Output is correct
8 Correct 13 ms 1460 KB Output is correct
9 Correct 15 ms 1452 KB Output is correct
10 Correct 14 ms 1452 KB Output is correct
11 Correct 14 ms 1424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 2720 KB Output is correct
2 Correct 194 ms 11652 KB Output is correct
3 Correct 407 ms 24568 KB Output is correct
4 Correct 336 ms 21216 KB Output is correct
5 Correct 370 ms 21280 KB Output is correct
6 Correct 444 ms 21864 KB Output is correct
7 Correct 388 ms 23052 KB Output is correct
8 Correct 344 ms 20428 KB Output is correct
9 Correct 337 ms 21448 KB Output is correct
10 Correct 430 ms 24172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 3056 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 664 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 3524 KB Error - advice is too long
2 Incorrect 14 ms 3476 KB Error - advice is too long
3 Incorrect 14 ms 3456 KB Error - advice is too long
4 Incorrect 17 ms 3400 KB Error - advice is too long
5 Incorrect 14 ms 3532 KB Error - advice is too long
6 Incorrect 14 ms 3448 KB Error - advice is too long
7 Incorrect 14 ms 3428 KB Error - advice is too long
8 Incorrect 15 ms 3376 KB Error - advice is too long
9 Incorrect 14 ms 3540 KB Error - advice is too long
10 Incorrect 15 ms 3372 KB Error - advice is too long