Submission #280549

# Submission time Handle Problem Language Result Execution time Memory
280549 2020-08-22T22:19:33 Z ElyesChaabouni Last supper (IOI12_supper) C++14
0 / 100
543 ms 21084 KB
#include "advisor.h"
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000000
#define PI 3.14159265358979323846
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
	int nb=0;
	int cu=N;
	while(cu)
	{
		nb++;
		cu/=2;
	}
	for(int i = 0; i < N; i++)
	{
		int x=C[i];
		for(int j = 0; j < nb; j++)
		{
			WriteAdvice((x%2));
			x/=2;
		}
	}
}
//size
#include "assistant.h"
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000000
#define PI 3.14159265358979323846
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
	int cu=N, nb=0;
	while(cu)
	{
		nb++;
		cu/=2;
	}
	vector<int>v[N+1];
	int step=0;
	for(int i = 0; i*nb+nb-1 < R; i++)
	{
		int x=0, p=1;
		for(int j = 0; j < nb; j++)
		{
			if(A[i*nb+j]=='1')
				x+=p;
			p*=2;
		}
		v[x].push_back(step);
		step++;
	}
	for(int i = 0; i < N; i++)
		v[i].push_back(1000000000);
    set<int>s;
    for(int i = 0; i < K; i++)
    	s.insert(i);
    priority_queue<pair<int, int> >pq;
    for(int i = 0; i < K; i++)
    	pq.push(make_pair(v[i][0], i));
    for(int i = 0; i < N; i++)
    {
    	int next_color=GetRequest();
    	if(!s.count(next_color))
    	{
    		while(!s.count(pq.top().second))
    		{
    			pq.pop();
    		}
    		PutBack(pq.top().second);
    		s.erase(pq.top().second);
    		s.insert(next_color);
    	}
    	vector<int>::iterator it=upper_bound(v[next_color].begin(), v[next_color].end(), i);
    	pq.push(make_pair((*it), next_color));
    }
}
//size
# Verdict Execution time Memory Grader output
1 Correct 1 ms 772 KB Output is correct
2 Incorrect 1 ms 772 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 2648 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 404 ms 17268 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1012 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 522 ms 20576 KB Output isn't correct - not an optimal way
2 Incorrect 523 ms 20832 KB Output isn't correct - not an optimal way
3 Incorrect 498 ms 21084 KB Output isn't correct - not an optimal way
4 Incorrect 543 ms 20848 KB Output isn't correct - not an optimal way
5 Incorrect 499 ms 20960 KB Output isn't correct - not an optimal way
6 Incorrect 504 ms 20940 KB Output isn't correct - not an optimal way
7 Incorrect 505 ms 20836 KB Output isn't correct - not an optimal way
8 Incorrect 497 ms 20968 KB Output isn't correct - not an optimal way
9 Incorrect 495 ms 20956 KB Output isn't correct - not an optimal way
10 Incorrect 499 ms 20888 KB Output isn't correct - not an optimal way