Submission #230762

#TimeUsernameProblemLanguageResultExecution timeMemory
230762Dilshod_ImomovParrots (IOI11_parrots)C++17
34 / 100
10 ms1536 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
	vector < int > vc;
	int ind = 0;
	for ( int i = 0; i < N; i++ ) {
		int x = M[i];
		if ( x < 10 ) {
			vc.push_back( ind++ );
			vc.push_back( ind++ );
			vc.push_back( x * 100 + ind++ );
		}
		else if ( x < 100 ) {
			vc.push_back( ind++ );
			int y = x / 10;
			vc.push_back( y * 100  + ind++ );
			y = x % 10;
			vc.push_back( y * 100 + ind++ );
		}
		else {
			int y = x / 100;
			vc.push_back( y * 100 + ind++ );
			y = (x % 100) / 10;
			vc.push_back( y * 100 + ind++ );
			y = x % 10;
			vc.push_back( y * 100 + ind++ );
		}
	}
	for ( auto i: vc ) {
		send(i);
		// cout << i << ' ';
	}
	// cout << '\n';
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
	map < int, int > mp;
	for ( int i = 0; i < L; i++ ) {
		int x = X[i] % 10;
		int y = X[i] % 100 / 10;
		mp[ y * 10 + x ] = X[i] / 100;
	}
	int ind = 0;
	for ( int i = 0; i < N; i++ ) {
		int x = mp[ind++], y = mp[ind++], z = mp[ind++];
		int ans = x * 100 + y * 10 + z;
		output(ans);
		// cout << ans << ' ';
	}
	// cout << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...