Submission #283375

# Submission time Handle Problem Language Result Execution time Memory
283375 2020-08-25T15:23:26 Z ElyesChaabouni Last supper (IOI12_supper) C++14
0 / 100
449 ms 21604 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;
	}
	//cout << nb << '\n';
	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;
	}
	//cout << "here\n";
	vector<int>v[N+1];
	int step=0;
	for(int i = 0; i+nb-1 < R; i+=nb)
	{
		int x=0, p=1;
		for(int j = 0; j < nb; j++)
		{
			if(A[i+j]=='1')
				x+=p;
			p*=2;
		}
		//cout << x << '\n';
		v[x].push_back(step);
		step++;
	}
	for(int i = 0; i <= N; i++)
		v[i].push_back(100000000);
    set<int>s;
    set<pair<int, int> >pq;
    for(int i = 0; i <= K; i++)
    	s.insert(i);
    for(int i = 0; i <= K; i++)
    	pq.insert(make_pair(v[i][0], i));
    for(int i = 0; i < N; i++)
    {
    	int next_color=GetRequest();
    	if(!s.count(next_color))
    	{
    		set<pair<int, int> >::iterator it=pq.end();
    		it=prev(it);
    		int to_take_back=(*it).second;
    		PutBack(to_take_back);
    		s.erase(to_take_back);
    		pq.erase(it);
    		s.insert(next_color);
    	}
    	else
    	{
    		pq.erase(make_pair(i, next_color));
    	}
    	vector<int>::iterator it1=upper_bound(v[next_color].begin(), v[next_color].end(), i);
    	pq.insert(make_pair((*it1), next_color));
    }
}
//size
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 780 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2780 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 349 ms 17296 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 848 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 431 ms 20808 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 429 ms 21100 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 432 ms 21468 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 424 ms 21268 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 447 ms 21604 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 433 ms 21476 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 434 ms 21196 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 432 ms 21144 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 449 ms 21536 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 427 ms 21340 KB Error - Putting back a color that is not on the scaffold