답안 #219631

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
219631 2020-04-05T20:37:02 Z MarcoMeijer 최후의 만찬 (IOI12_supper) C++14
0 / 100
375 ms 286696 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 = 2e5;
queue<int> nxt[MX];
set<int> onShelf;
priority_queue<ii> pq;
map<int, int> last;
vi ans;
vi shelf;

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]);
  }
  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);
  }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 99 ms 270064 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 112 ms 271088 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 281 ms 280816 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 270576 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 339 ms 282984 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Runtime error 375 ms 283600 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
3 Runtime error 345 ms 284136 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
4 Runtime error 348 ms 284136 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
5 Runtime error 331 ms 283880 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
6 Runtime error 345 ms 284032 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
7 Runtime error 337 ms 284392 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
8 Runtime error 355 ms 284392 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
9 Runtime error 344 ms 284136 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
10 Runtime error 330 ms 286696 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)