Submission #118571

# Submission time Handle Problem Language Result Execution time Memory
118571 2019-06-19T09:06:06 Z win11905 Last supper (IOI12_supper) C++11
0 / 100
457 ms 150000 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);
    S.erase(val);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 74 ms 135408 KB Output is correct
2 Incorrect 72 ms 135664 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 84 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 278 ms 147184 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 77 ms 135480 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 333 ms 148984 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 457 ms 149200 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 343 ms 149488 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 350 ms 149744 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 346 ms 149576 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 402 ms 150000 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 358 ms 149712 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 343 ms 149488 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 352 ms 149672 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 407 ms 149744 KB Error - Putting back a color when it is already on the scaffold