Submission #121403

# Submission time Handle Problem Language Result Execution time Memory
121403 2019-06-26T13:23:43 Z MAMBA Last supper (IOI12_supper) C++14
0 / 100
199 ms 138720 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back

void ComputeAdvice(int S[], int n, int k, int ignore) {
  deque<int> c[n];
  vector<bool> mark(n);
  vector<bool> res(n + k);
  priority_queue<pair<int, int>> pq;
  rep(i, 0, k) {
    c[i].push_back(i);
    mark[i] = true;
  }
  rep(i, 0, n) c[S[i]].push_back(i + k);

  rep(i, 0, k) {
    int v = c[i].front();
    c[i].pop_front();
    int u = n + k;
    if (!c[i].empty()) u = c[i].front();
    pq.push({u, v});
  }

  rep(i, 0, n) {
    c[S[i]].pop_front();
    int u = n + k;
    if (!c[S[i]].empty()) u = c[S[i]].front();
    pq.push({u, i + k});
    if (!mark[S[i]]) {
      int id = pq.top().second;
      pq.pop();
      res[id] = true;
      if (id >= k) id = S[id - k];
      mark[id] = false;
      mark[S[i]] = true;
    }
  }
  rep(i, 0, k + n) WriteAdvice(res[i]);
}
#include <bits/stdc++.h>
#include "assistant.h"

using namespace std;

#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back

void Assist(unsigned char A[], int n, int k, int ignore) {
  vector<bool> mark(n);
  vector<int> q;
  int l = 0;
  rep(i, 0, k) {
    mark[i] = true;
    if (A[i]) q.pb(i);
  }
  rep(i, 0, n) {
    int g = GetRequest();
    if (A[i + k]) q.pb(g);
    if (!mark[g]) {
      PutBack(q[l]);
      mark[q[l++]] = false;
      mark[g] = true;
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 776 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 17 ms 14584 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 144 ms 111400 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 9 ms 6144 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 165 ms 138656 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 188 ms 138464 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 167 ms 138464 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 177 ms 138696 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 199 ms 138464 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 178 ms 138720 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 176 ms 138208 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 181 ms 138512 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 168 ms 138616 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 170 ms 138296 KB Error - Putting back a color that is not on the scaffold