답안 #121396

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121396 2019-06-26T13:17:38 Z MAMBA 최후의 만찬 (IOI12_supper) C++14
0 / 100
196 ms 138592 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 (A[i + k]) q.pb(g);
    if (!mark[g]) {
      PutBack(q[l]);
      mark[q[l++]] = false;
      mark[g] = true;
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Incorrect 4 ms 776 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 14336 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 125 ms 111296 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 6144 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 172 ms 138296 KB Output isn't correct - not an optimal way
2 Incorrect 178 ms 138384 KB Output isn't correct - not an optimal way
3 Incorrect 159 ms 138336 KB Output isn't correct - not an optimal way
4 Incorrect 172 ms 138368 KB Output isn't correct - not an optimal way
5 Incorrect 172 ms 138592 KB Output isn't correct - not an optimal way
6 Incorrect 163 ms 138336 KB Output isn't correct - not an optimal way
7 Incorrect 196 ms 138256 KB Output isn't correct - not an optimal way
8 Incorrect 162 ms 138200 KB Output isn't correct - not an optimal way
9 Incorrect 164 ms 138336 KB Output isn't correct - not an optimal way
10 Correct 184 ms 138264 KB Output is correct - 125000 bits used