Submission #94124

# Submission time Handle Problem Language Result Execution time Memory
94124 2019-01-16T10:47:33 Z fjzzq2002 Last supper (IOI12_supper) C++14
0 / 100
108 ms 9200 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
#define SZ 222222
typedef pair<int,int> pii;
#define fi first
#define se second
int d[SZ],e[SZ],f[SZ],ns[SZ],ts[SZ];
void ComputeAdvice(int *C,int N,int K,int M)
{
	for(int i=0;i<N;++i) f[i]=-1,ts[i]=2e9;
	for(int i=0;i<N+K;++i)
	{
		if(i<K) d[i]=i;
		else d[i]=C[i-K];
	}
	for(int i=N+K-1;i>=0;--i)
		ns[i]=ts[d[i]],ts[d[i]]=i;
	priority_queue<pii> pq,eq;
	for(int i=0;i<K;++i)
		pq.push(pii(2e9+i,-1));
	for(int i=0;i<N+K;++i)
	{
		while(pq.size()&&eq.size()&&pq.top()==eq.top())
			pq.pop(),eq.pop();
		int x=d[i];
		if(~f[x])
			eq.push(pii(i,f[x]));
		else
		{
			auto w=pq.top(); pq.pop();
			if(~w.se) e[w.se]=1,f[d[w.se]]=-1;
		}
		f[x]=i; pq.push(pii(ns[i],i));
	}
	for(int i=0;i<N+K;++i)
		WriteAdvice(e[i]);
}
#include "assistant.h"
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
#define SZ 222222
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
bool in[SZ];
void Assist(unsigned char *A, int N, int K, int R)
{
	vector<int> gg;
	for(int i=0;i<K;++i)
	{
		in[i]=1;
		if(A[i]) gg.pb(i);
	}
	for(int i=K;i<N+K;++i)
	{
		int u=GetRequest();
		if(!in[u])
		{
			if(!gg.size()) throw "GG";
			int w=gg.back();
			gg.pop_back();
			PutBack(w);
			in[w]=0;
		}
		if(A[u]) gg.pb(u);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 888 KB Output is correct
2 Incorrect 4 ms 764 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1728 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 7392 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1264 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 9176 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 71 ms 9184 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 72 ms 9200 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 73 ms 9192 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 70 ms 9128 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 70 ms 9128 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 69 ms 8928 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 70 ms 8928 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 108 ms 8928 KB Error - Putting back a color when it is already on the scaffold
10 Runtime error 71 ms 8240 KB Execution killed with signal 11 (could be triggered by violating memory limits)