답안 #623130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623130 2022-08-05T08:42:32 Z ollel 최후의 만찬 (IOI12_supper) C++14
0 / 100
2500 ms 4736 KB
using namespace std;
#include <bits/stdc++.h>
#include "advisor.h"


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<bool> vb;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back


void ComputeAdvice(int *c, int n, int k, int m) {
  set<int> scaffold;
  rep(i,0,k) scaffold.insert(i);


  vi advice(2*n, 0);
  vi added(n, 0);
  rep(i,0,k) added[i] = i;

  rep(i,0,n) {
    int color = c[i];
    if (scaffold.find(color) != scaffold.end()) {
      added[color] = n+i;
      continue;
    }

    set<int> passed;
    bool adviced = false;
    rep(j,i+1,n) {
      if (passed.size() == scaffold.size() - 1) {
        int res = 0;
        for (auto x : scaffold) if (passed.find(x) == passed.end()) res = x;
        advice[added[res]] = 1;
        scaffold.erase(res);
        adviced = true;
      }

      if (scaffold.find(c[j]) != scaffold.end()) passed.insert(c[j]);
    }
    if (!adviced) {
      int res = 0;
      for (auto x : scaffold) if (passed.find(x) == passed.end()) res = x;
      advice[added[res]] = 1;
      scaffold.erase(res);
    }
  }
  rep(i,0,2*n) WriteAdvice(advice[i]);
}
using namespace std;
#include <bits/stdc++.h>
#include "assistant.h"


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<bool> vb;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back



void Assist(unsigned char *a, int n, int k, int r) {
  set<int> scaffold;
  rep(i,0,k) scaffold.insert(i);

  vector<int> advice(2*n);
  rep(i,0,2*n) advice[i] = a[i];
  queue<int> q;
  rep(i,0,k) if (advice[i] == 1) q.push(i);

  rep(i,0,n) {
    int nextColor = GetRequest();
    if (scaffold.find(nextColor) == scaffold.end()) {
      int rem = q.front(); q.pop();
      PutBack(rem);
      scaffold.erase(rem);
      scaffold.insert(nextColor);
    }
    if (advice[n + i] == 1) {
      q.push(nextColor);
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 712 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 742 ms 1276 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2583 ms 3404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 215 ms 872 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2567 ms 3872 KB Time limit exceeded
2 Execution timed out 2589 ms 4044 KB Time limit exceeded
3 Execution timed out 2586 ms 4280 KB Time limit exceeded
4 Execution timed out 2574 ms 4304 KB Time limit exceeded
5 Execution timed out 2591 ms 4308 KB Time limit exceeded
6 Execution timed out 2552 ms 4292 KB Time limit exceeded
7 Execution timed out 2570 ms 4276 KB Time limit exceeded
8 Execution timed out 2549 ms 4300 KB Time limit exceeded
9 Execution timed out 2567 ms 4300 KB Time limit exceeded
10 Execution timed out 2579 ms 4736 KB Time limit exceeded