Submission #348434

# Submission time Handle Problem Language Result Execution time Memory
348434 2021-01-15T02:21:25 Z daniel920712 Last supper (IOI12_supper) C++14
0 / 100
20 ms 6252 KB
#include "advisor.h"
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
int where[1000005];
int Next[1000005];
vector < int > when[100005];
map < int , int > how;
void ComputeAdvice(int *C, int N, int K, int M) 
{
	int t=0,now=1,xx,i,j;
	while(now<K)
	{
		now*=2;
		t++;
	}
	for(i=0;i<K;i++) 
	{
		where[i]=i;
		how[when[i][0]]=i;
	}
	for(i=K;i<N;i++) where[i]=-1;
	for(i=0;i<N;i++) when[C[i]].push_back(i);
	for(i=0;i<N;i++) when[C[i]].push_back(i+N);
	for(i=0;i<N;i++) Next[i]=*upper_bound(when[C[i]].begin(),when[C[i]].end(),i);
	for(i=0;i<N;i++)
	{
		if(how.find(i)!=how.end()) how.erase(i);
		if(where[C[i]]==-1)
		{
			xx=where[prev(how.end())->second];
			for(i=0;i<t;i++) 
			{
				if(xx&(1<<i)) WriteAdvice(1);
				else WriteAdvice(0);
			}
		}
		how[Next[i]]=C[i]; 
	}

}
#include "assistant.h"
int where2[1000005];
int what[1000005];
void Assist(unsigned char *A, int N, int K, int R) {

    int t=0,now=1,xx=0,how,tt=0,i,j;
	while(now<K)
	{
		now*=2;
		t++;
	}
	for(i=0;i<K;i++) 
	{
		where2[i]=i;
		what[i]=i;
	}
	for(i=K;i<N;i++) where2[i]=-1;
	for(i=0;i<N;i++)
	{
		how=GetRequest();
		if(where2[how]==-1)
		{
			xx=0;
			for(j=0;j<t;j++) xx+=A[j+tt]*(1<<j);
			tt+=t;
			PutBack(tt);
			where2[how]=tt;
			where2[what[tt]]=-1;
			what[tt]=how;
			
		}
	}

}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:13:21: warning: unused variable 'j' [-Wunused-variable]
   13 |  int t=0,now=1,xx,i,j;
      |                     ^
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5228 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 Runtime error 7 ms 5356 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 Runtime error 16 ms 6124 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 Runtime error 7 ms 5228 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 Runtime error 17 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 20 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 17 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 18 ms 6124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 19 ms 6124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 17 ms 6124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 17 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 17 ms 6124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 19 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 17 ms 6252 KB Execution killed with signal 11 (could be triggered by violating memory limits)