Submission #913835

# Submission time Handle Problem Language Result Execution time Memory
913835 2024-01-20T10:22:20 Z Muhammad_Aneeq Last supper (IOI12_supper) C++17
8 / 100
2500 ms 28528 KB
#include "advisor.h"
#include <cmath>
#include <map>
#include <set>
#include <iostream>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M)
{
	for (int i=0;i<N;i++)
	{
		for (int j=0;j<=log2(N);j++)
		{
			if ((1<<j)&C[i])
				WriteAdvice(1);
			else
				WriteAdvice(0);
		}
	}
}
#include "assistant.h"
#include <cmath>
#include <map>
#include <set>
#include <iostream>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R)
{
	int re[N]={};
	int z=log2(N);
	map<int,int>d;
	set<int>res[N]={};
	for (int i=0;i<N;i++)
	{
		for (int j=0;j<=z;j++)
			re[i]+=(A[i*(z+1)+j]<<j);
		res[re[i]].insert(i);
		d[re[i]]++;
	}
	set<int>ind;
	for (int i=0;i<K;i++)
		ind.insert(i);
	for (int i=0;i<N;i++)
	{
		int z=GetRequest();
		d[z]--;
		res[z].erase(i); 
		if (ind.find(z)!=ind.end())
			continue;	
		int x=0;
		int f=-1;
		for (auto i:ind)
		{
			if (d[i]==0)
			{
				x=i;
				f=-1;
				break;
			}
			else
			{
				if (res[i].size()&&*begin(res[i])>f)
				{
					f=*begin(res[i]);
					x=i;
				}
			}
		}
		PutBack(x);
		ind.insert(z);
		ind.erase(x);
		res[i].erase(f);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 776 KB Output is correct
2 Correct 1 ms 784 KB Output is correct
3 Correct 2 ms 1060 KB Output is correct
4 Correct 10 ms 1116 KB Output is correct
5 Correct 15 ms 1944 KB Output is correct
6 Correct 20 ms 1960 KB Output is correct
7 Correct 16 ms 1876 KB Output is correct
8 Correct 70 ms 1960 KB Output is correct
9 Correct 64 ms 1980 KB Output is correct
10 Correct 39 ms 2016 KB Output is correct
11 Correct 63 ms 1820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 302 ms 3168 KB Output is correct
2 Execution timed out 2512 ms 12112 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2578 ms 21592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 792 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2583 ms 26680 KB Time limit exceeded
2 Execution timed out 2595 ms 26704 KB Time limit exceeded
3 Execution timed out 2570 ms 26688 KB Time limit exceeded
4 Execution timed out 2599 ms 27216 KB Time limit exceeded
5 Execution timed out 2588 ms 26788 KB Time limit exceeded
6 Execution timed out 2585 ms 26896 KB Time limit exceeded
7 Execution timed out 2513 ms 27012 KB Time limit exceeded
8 Execution timed out 2594 ms 26592 KB Time limit exceeded
9 Execution timed out 2566 ms 26960 KB Time limit exceeded
10 Execution timed out 2517 ms 28528 KB Time limit exceeded