Submission #280524

# Submission time Handle Problem Language Result Execution time Memory
280524 2020-08-22T21:47:51 Z amiratou Last supper (IOI12_supper) C++14
Compilation error
0 ms 0 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 = nb-1; j >= 0; 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];
	for(int i = 0; i < N; i++)
	{
		int x=0;
		for(int j = 0; j < nb; j++)
		{
			if(A[i+j]=='1')
				x+=(1<<j);
		}
		v[x].push_back(i);
	}
	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((*it), next_color);
    }
}

//size

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:54:31: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(int&, int&)'
   54 |      pq.push((*it), next_color);
      |                               ^
In file included from /usr/include/c++/9/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from assistant.cpp:3:
/usr/include/c++/9/bits/stl_queue.h:627:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  627 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:627:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/9/bits/stl_queue.h:635:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  635 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:635:7: note:   candidate expects 1 argument, 2 provided