Submission #251720

# Submission time Handle Problem Language Result Execution time Memory
251720 2020-07-22T08:45:05 Z tinjyu Last supper (IOI12_supper) C++14
0 / 100
310 ms 16888 KB
#include <iostream>
#include <algorithm>
#include "advisor.h"
using namespace std;
long long int maxlen,ans[100005],k,map[100005],in[100005],t[100005],p[100005];
struct node{
	long long int road,id;
}now[100005];
struct cmp{
	bool operator()(const node &a,const node &b)
	{
		return a.road<b.road;
	}
};
void find(long long int x)
{
	for(int i=1;i<=maxlen;i++)
	{
		char tmp;
		if(x%2==0)tmp=0;
		else tmp=1;
		WriteAdvice(tmp);
		//cout<<x%2<<" ";
		x/=2;
	}
	return ;
}
void ComputeAdvice(int *C, int N, int K, int M) {
	k=K;
	long long int x=1;
	while(x<k)
	{
		x*=2;
		maxlen++;
	}
	for(int i=0;i<N;i++)now[i].road=10009;
	for(int i=0;i<N;i++)
	{
		map[i]=now[C[i]].road;
		now[C[i]].road=i;
	}
	for(int i=0;i<N;i++)p[i]=-1;
	for(int i=0;i<K;i++)
	{
		t[i]=i;
		now[i].id=i;
		p[i]=i;
		push_heap(now,now+i+1,cmp());
	}
	//for(int i=0;i<K;i++)cout<<now[i].id<<" ";
	//cout<<endl;
	for(int i=0;i<N;i++)
	{
		if(p[C[i]]!=-1)
		{
			now[C[i]].road=map[now[C[i]].road];
			continue;
		}
		else
		{
			pop_heap(now,now+K,cmp());
			p[C[i]]=p[now[K-1].id];
			find(p[C[i]]);
			p[now[K-1].id]=-1;
			now[C[i]].road=map[now[C[i]].road];
			now[K-1].id=C[i];
			push_heap(now,now+K,cmp());
		}
	}
}
#include "assistant.h"
#include <iostream>
using namespace std;
long long int a[100005],pp=0,malen,no[100005],pe[100005];
int find()
{
	long long int tmp=0,x=1;
	for(int i=pp;i<pp+malen;i++)
	{
		if(a[i]=='1')tmp+=x;
		x*=2;
	}
	pp+=malen;
	return tmp;
}
void Assist(unsigned char *A, int N, int K, int R) {
	for(int i=0;i<R;i++)
	{
		//cout<<A[i]<<endl;
		a[i]=A[i];
	}
	int k=K;
	long long int x=1;
	while(x<k)
	{
		x*=2;
		malen++;
	}
	for(int i=0;i<N;i++)pe[i]=-1;
	for(int i=0;i<k;i++)
	{
		no[i]=i;
		pe[i]=i;
	}
	for(int i=0;i<N;i++)
	{
		long long int tmp=GetRequest();
		if(pe[tmp]!=-1)
		{
			continue;
		}
		long long int temp=find();
		PutBack(no[temp]);
		pe[no[temp]]=-1;
		no[temp]=tmp;
		pe[tmp]=temp;
	}
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1000 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 2532 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 235 ms 13588 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1112 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 310 ms 16888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 292 ms 16888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 273 ms 16424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 279 ms 16396 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 279 ms 16384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 276 ms 16424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 282 ms 16444 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 297 ms 16368 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 265 ms 16380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 273 ms 16376 KB Execution killed with signal 11 (could be triggered by violating memory limits)