답안 #623131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623131 2022-08-05T08:44:18 Z ollel 최후의 만찬 (IOI12_supper) C++14
0 / 100
2500 ms 4092 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()) {
      assert(q.size() > 0);
      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 Runtime error 1 ms 636 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 750 ms 1564 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2556 ms 2900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 202 ms 1136 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2590 ms 3392 KB Time limit exceeded
2 Execution timed out 2576 ms 3540 KB Time limit exceeded
3 Execution timed out 2582 ms 3796 KB Time limit exceeded
4 Execution timed out 2600 ms 3772 KB Time limit exceeded
5 Execution timed out 2566 ms 3716 KB Time limit exceeded
6 Execution timed out 2595 ms 3692 KB Time limit exceeded
7 Execution timed out 2582 ms 3704 KB Time limit exceeded
8 Execution timed out 2578 ms 3660 KB Time limit exceeded
9 Execution timed out 2579 ms 3668 KB Time limit exceeded
10 Execution timed out 2593 ms 4092 KB Time limit exceeded