Submission #67411

# Submission time Handle Problem Language Result Execution time Memory
67411 2018-08-14T08:44:52 Z zetapi Parrots (IOI11_parrots) C++14
Compilation error
0 ms 0 KB
//#include "encoder.h"
//#include "encoderlib.h"
#include "bits/stdc++.h"
using namespace std;
 
#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr ::iterator 
 
typedef pair<int,int>  pii;
 
const int MAX=1e5;
 
void encode(int N,int M[])
{
	int arr[1000];
	vector<pii> vec;
	for(int A=0;A<N;A++)
	{
		send(M[A]);
		send(M[A]);
		send(M[A]);
		send(M[A]);
		send(M[A]);
		vec.pb(mp(M[A],A));
	}	
	sort(vec.begin(),vec.end());
	for(int A=0;A<vec.size();A++)
		arr[vec[A].second]=A;
 	for(int A=0;A<N;A++)
	{
		int res=A;
		for(int B=0;B<3;B++)
		{
			if(arr[A]&(1<<B))
				res+=1<<(B+5);
		}	
		send(res);
		if((arr[A]&(1<<3)) and ((arr[A])&(1<<4)))
			send(res);
		else if((arr[A]&(1<<3)))
			send(res),send(res);
		else if((arr[A])&(1<<4))
			send(res),send(res),send(res);
	}
	return ;
}
#include "decoder.h"
#include "decoderlib.h"
#include "bits/stdc++.h"
using namespace std;
 
#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr ::iterator 
 
typedef pair<int,int>  pii;
 
const int MAX=1e5;
 
void decode(int N, int L, int X[])
{
    assert(L==4*N);
	vector<int> vec;
	map<int,int> maps;
	int res[1000]={0};
  	for(int A=0;A<L;A++)
  		maps[X[A]]++;
  	for(auto A:maps)
  	{
  		int cur=A.second;
  		while(cur>=5)
  		{
  			cur-=5;
  			vec.pb(A.first);
  		}
  	}
  	sort(vec.begin(),vec.end());
  	for(auto A:maps)
  	{
  		if(A.second%5==0)
  			continue;
  		int ind=0,num=0;
  		for(int B=0;B<5;B++)
  			if(A.first&(1<<B))
  				ind+=(1<<B);
  		for(int B=0;B<3;B++)
  			if(A.first&(1<<(B+5)))
  				num+=(1<<B);
  		if(A.second==2)
  			num+=(1<<3)+(1<<4);
  		else if(A.second==3)
  			num+=(1<<3);
  		else if(A.second==4)
  			num+=(1<<4);
  		res[ind]=num;
  	}
  	for(int A=0;A<N;A++)
  		output(vec[res[A]]);
  	return ;
}

Compilation message

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:21:3: error: 'send' was not declared in this scope
   send(M[A]);
   ^~~~
encoder.cpp:21:3: note: suggested alternative: 'setns'
   send(M[A]);
   ^~~~
   setns
encoder.cpp:29:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<vec.size();A++)
              ~^~~~~~~~~~~
encoder.cpp:39:3: error: 'send' was not declared in this scope
   send(res);
   ^~~~
encoder.cpp:39:3: note: suggested alternative: 'setns'
   send(res);
   ^~~~
   setns