답안 #804455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
804455 2023-08-03T08:48:32 Z Dan4Life 최후의 만찬 (IOI12_supper) C++17
0 / 100
284 ms 19580 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	int x = *min_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%20?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});
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Runtime error 2 ms 640 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 2468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 220 ms 15824 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 664 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 216 ms 17996 KB Execution killed with signal 11
2 Runtime error 237 ms 18140 KB Execution killed with signal 11
3 Runtime error 214 ms 18136 KB Execution killed with signal 11
4 Runtime error 213 ms 18112 KB Execution killed with signal 11
5 Runtime error 215 ms 18088 KB Execution killed with signal 11
6 Runtime error 217 ms 18040 KB Execution killed with signal 11
7 Incorrect 284 ms 19580 KB Output isn't correct - not an optimal way
8 Runtime error 226 ms 18048 KB Execution killed with signal 11
9 Runtime error 225 ms 17928 KB Execution killed with signal 11
10 Runtime error 213 ms 17956 KB Execution killed with signal 11