#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int kiedy[LIM], nxt[LIM], on[LIM], uzyte[2*LIM];
void ComputeAdvice(int *c, int n, int k, int m) {
rep(i, n) kiedy[i]=n;
for(int i=n-1; i>=0; --i) {
nxt[i]=kiedy[c[i]];
kiedy[c[i]]=i;
}
priority_queue<pair<int,pair<int,int>>>q;
rep(i, k) {
on[i]=1;
q.push({kiedy[i], {i, i}});
}
rep(i, n) {
if(!on[c[i]]) {
int a=q.top().nd.st, b=q.top().nd.nd; q.pop();
uzyte[b]=1;
on[a]=0;
}
on[c[i]]=1;
q.push({nxt[i], {c[i], i+k}});
}
rep(i, n+k) WriteAdvice(uzyte[i]);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int xd[LIM];
void Assist(unsigned char *A, int n, int k, int r) {
rep(i, r) if(A[i]) cout << 1; else cout << 0;
queue<int>q;
rep(i, k) {
xd[i]=1;
if(A[i]) q.push(i);
}
rep(i, n) {
int a=GetRequest();
if(!xd[a]) {
int p=q.front(); q.pop();
PutBack(p);
xd[a]=1;
xd[p]=0;
}
if(A[k+i]) q.push(a);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
496 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1260 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
5648 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
936 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
82 ms |
7404 KB |
Hacked |
2 |
Incorrect |
71 ms |
7384 KB |
Hacked |
3 |
Incorrect |
71 ms |
7256 KB |
Hacked |
4 |
Incorrect |
79 ms |
7404 KB |
Hacked |
5 |
Incorrect |
75 ms |
7324 KB |
Hacked |
6 |
Incorrect |
73 ms |
7200 KB |
Hacked |
7 |
Incorrect |
71 ms |
7256 KB |
Hacked |
8 |
Incorrect |
75 ms |
7276 KB |
Hacked |
9 |
Incorrect |
77 ms |
7340 KB |
Hacked |
10 |
Incorrect |
76 ms |
6740 KB |
Hacked |