Submission #125039

# Submission time Handle Problem Language Result Execution time Memory
125039 2019-07-04T13:27:01 Z RockyB Last supper (IOI12_supper) C++17
0 / 100
538 ms 46064 KB
#include "advisor.h"
#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back

#define sz(x) (int)x.size()

#define rep(z, a, b) for (int z = (a); (z) <= (b); z++)
#define per(z, a, b) for (int z = (a); (z) >= (b); z--)

using namespace std;

const int MAXN = (int)2e5 + 7;


vector <int> nxt[MAXN];
set <int> in;
set < pair <int, int > > dp;
void ComputeAdvice(int *C, int N, int K, int M) {
  rep(i, 0, N - 1) {
    nxt[i].pb(N);
  }
  per(i, N - 1, 0) {
    nxt[C[i]].pb(i);
  }
  rep(i, 0, K - 1) {
    in.insert(i);
  }
  rep(i, 0, N - 1) {
    dp.insert({nxt[i].back(), i});
  }
  int LOG = log2(N);
  rep(i, 0, N - 1) {
    if (in.count(C[i])) {
      WriteAdvice(0);
      continue;
    }

    while (sz(in) && dp.begin() -> f < i) {
      int x = dp.begin() -> s;
      dp.erase(dp.begin());
      nxt[x].pp();
      dp.insert({nxt[x].back(), x});
    }

    int del = dp.rbegin() -> s;
    in.erase(del);
    in.insert(C[i]);
    WriteAdvice(1);
    rep(j, 0, LOG) {
      if (del & (1 << j)) WriteAdvice(1);
      else WriteAdvice(0);
    }
  }
} 
#include "assistant.h"
#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back

#define sz(x) (int)x.size()

#define rep(z, a, b) for (int z = (a); (z) <= (b); z++)
#define per(z, a, b) for (int z = (a); (z) >= (b); z--)

using namespace std;

const int MAXN = (int)2e5 + 7;

void Assist(unsigned char *A, int N, int K, int R) {
  int LOG = log2(N);

  for (int i = 0; i < R; ) {
    GetRequest();
    if (A[i] == 0) {
      i++;
      continue;
    }
    else {
      i++;
      int val = 0;
      rep(j, 0, LOG) {
        if (A[i + j]) val |= 1 << j;
      }
      i += LOG;
      PutBack(val);
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 9968 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 13296 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 355 ms 35056 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 10992 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 458 ms 41544 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 462 ms 41456 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 460 ms 41120 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 475 ms 41208 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 455 ms 41200 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 460 ms 41304 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 450 ms 41200 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 486 ms 41240 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 446 ms 41472 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 538 ms 46064 KB Error - Putting back a color that is not on the scaffold