Submission #118570

# Submission time Handle Problem Language Result Execution time Memory
118570 2019-06-19T09:02:56 Z win11905 Last supper (IOI12_supper) C++11
0 / 100
418 ms 151024 KB
#include <bits/stdc++.h>
#include "advisor.h"
#define pii pair<int, int>
#define x first
#define y second
using namespace std;

const int N = 1e5+5;

static queue<int> pos[N];
static bool inq[N];

void ComputeAdvice(int *C, int N, int K, int M) {
  for(int i = 0; i < N; ++i) pos[C[i]].emplace(i);
  for(int i = 0; i < N; ++i) pos[i].emplace(N);
  set<pii, greater<pii> > Q;
  for(int i = 0; i < K; ++i) Q.emplace(pos[i].front(), i), inq[i] = true;
  for(int i = 0; i < N; ++i) {
    if(inq[C[i]]) {
      Q.erase(pii(pos[C[i]].front(), i));
    } else {
      int v = Q.begin()->y; Q.erase(Q.begin());
      inq[v] = false, inq[C[i]] = true;
      for(int i = 0; i < 17; ++i) WriteAdvice(v >> i & 1);
    } 
    pos[C[i]].pop();
    Q.emplace(pos[C[i]].front(), C[i]);
  }
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std; 

void Assist(unsigned char *A, int N, int K, int R) {
  set<int> S; 
  for(int i = 0; i < K; ++i) S.emplace(i);
  int ptr = 0;
  for(int i = 0; i < N; ++i) {
    if(S.count(GetRequest())) continue;
    int val = 0;
    for(int i = 0; i < 17; ++i) if(A[ptr++]) val |= (1 << i);
    PutBack(val);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 62 ms 135408 KB Output is correct
2 Incorrect 73 ms 135152 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 136688 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 269 ms 147384 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 135664 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 334 ms 150256 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 332 ms 150304 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 361 ms 150968 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 338 ms 150512 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 365 ms 150680 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 358 ms 150512 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 359 ms 150512 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 341 ms 150768 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 336 ms 150512 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 418 ms 151024 KB Error - Putting back a color when it is already on the scaffold