답안 #219640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
219640 2020-04-05T21:01:43 Z MarcoMeijer 최후의 만찬 (IOI12_supper) C++14
0 / 100
286 ms 151528 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()

const int MX = 1e5;
queue<int> nxt[MX];
set<int> onShelf;
priority_queue<ii> pq;
map<int, int> last;
vi ans;

void ComputeAdvice(int *C, int N, int K, int M) {
  RE(i,N) nxt[C[i]].push(i);
  RE(i,N) nxt[i].push(N);
  ans.assign(K+N,0);
  RE(i,K) {
    onShelf.insert(i);
    pq.push({nxt[i].front(), i});
    last[i] = i;
  }
  RE(i,N) {
    nxt[C[i]].pop();
    last[C[i]] = K+i;
    if(onShelf.count(C[i])) continue;
    ii p = pq.top(); pq.pop();
    ans[last[p.second]] = 1;
    onShelf.erase(p.se);
    pq.push({nxt[C[i]].front(), C[i]});
    onShelf.insert(C[i]);
  }
  while(!pq.empty()) {
    ii p = pq.top(); pq.pop();
    ans[last[p.second]] = 1;
  }
  for(int i:ans) WriteAdvice(i);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;

//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()

set<int> OnShelf;
queue<int> rem;

void Assist(unsigned char *A, int N, int K, int R) {
  /*RE(i,K) {
    OnShelf.insert(i);
    if(A[i]) rem.push(i);
  }
  RE(i,N) {
    int req = GetRequest();
    if(!OnShelf.count(req)) {
      PutBack(rem.front());
      OnShelf.erase(rem.front()); rem.pop();
      OnShelf.insert(req);
    }
    if(A[K+i]) rem.push(req);
  }*/
  RE(i,N) {
    int req = GetRequest();
  }
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:43:9: warning: unused variable 'req' [-Wunused-variable]
     int req = GetRequest();
         ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 135152 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 68 ms 136432 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 227 ms 145896 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 135880 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 266 ms 147944 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 281 ms 148584 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 252 ms 148456 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 271 ms 148712 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 254 ms 148456 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 286 ms 148712 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 257 ms 148456 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 272 ms 148456 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 256 ms 149224 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 258 ms 151528 KB Error - Not putting back color when it is not on the scaffold