답안 #121389

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121389 2019-06-26T13:11:49 Z MAMBA 최후의 만찬 (IOI12_supper) C++17
0 / 100
185 ms 139616 KB
#include <bits/stdc++.h>
#include "advisor.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();
    if (!mark[S[i]]) {
      int id = pq.top().second;
      pq.pop();
      res[id] = true;
      if (id >= k) id = S[id - k];
      mark[id] = false;
      int u = n + k;
      if (!c[S[i]].empty()) u = c[S[i]].front();
      pq.push({u, i + k});
      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 (mark[i + k]) q.pb(g);
    if (!mark[g]) {
      PutBack(q[l]);
      mark[q[l++]] = false;
      mark[g] = true;
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 640 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 14336 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 128 ms 112336 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 6176 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 161 ms 139448 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 185 ms 139520 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 161 ms 139360 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 159 ms 139384 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 160 ms 139360 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 160 ms 139400 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 157 ms 139104 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 175 ms 139360 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 162 ms 139616 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 163 ms 139360 KB Error - Putting back a color that is not on the scaffold