# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
271900 |
2020-08-18T07:56:59 Z |
송준혁(#5108) |
Last supper (IOI12_supper) |
C++14 |
|
2500 ms |
9432 KB |
#include "advisor.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
static int A[202020], X[202020], R[101010];
static int B[202020];
static priority_queue<pii> PQ;
void ComputeAdvice(int *C, int N, int K, int M) {
for (int i=0; i<K; i++) A[i]=i;
for (int i=0; i<N; i++) A[i+K]=C[i], R[i]=N+K;
for (int i=N+K-1; i>=0; i--) X[i]=R[A[i]], R[A[i]]=i;
memset(R, -1, sizeof R);
for (int i=0; i<K; i++) PQ.push(pii(X[i], i)), R[i]=i;
for (int i=K; i<K+N; i++){
if (R[A[i]]<0){
while (R[A[PQ.top().se]] != PQ.top().se) PQ.pop();
B[PQ.top().se]=1, R[PQ.top().se]=-1;
}
R[A[i]]=i, PQ.push(pii(X[i], i));
}
for (int i=0; i<K+N; i++) WriteAdvice(B[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
static bool chk[101010];
static set<int> E;
void Assist(unsigned char *A, int N, int K, int R) {
for (int i=0; i<K; i++){
if (A[i]) E.insert(i);
chk[i]=true;
}
for (int i=0; i<N; i++){
int x=GetRequest();
if (!chk[x]) PutBack(*E.begin()), E.erase(E.begin());
if (A[i+K]) E.insert(x);
else E.erase(x);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1536 KB |
Output is correct |
2 |
Execution timed out |
2510 ms |
1536 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2572 ms |
2304 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2597 ms |
7640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2590 ms |
1792 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2502 ms |
8920 KB |
Time limit exceeded |
2 |
Execution timed out |
2586 ms |
8920 KB |
Time limit exceeded |
3 |
Execution timed out |
2586 ms |
9432 KB |
Time limit exceeded |
4 |
Execution timed out |
2578 ms |
9176 KB |
Time limit exceeded |
5 |
Execution timed out |
2597 ms |
9176 KB |
Time limit exceeded |
6 |
Execution timed out |
2586 ms |
9176 KB |
Time limit exceeded |
7 |
Execution timed out |
2592 ms |
9040 KB |
Time limit exceeded |
8 |
Execution timed out |
2569 ms |
9432 KB |
Time limit exceeded |
9 |
Execution timed out |
2570 ms |
9176 KB |
Time limit exceeded |
10 |
Incorrect |
87 ms |
9432 KB |
Error - Putting back a color when it is already on the scaffold |