답안 #444379

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
444379 2021-07-13T19:47:07 Z skittles1412 앵무새 (IOI11_parrots) C++17
0 / 100
16 ms 1616 KB
#include "encoder.h"
#include "encoderlib.h"
#include "decoder.h"
#include "decoderlib.h"
#include "bits/extc++.h"

using namespace std;

template<class T>
using mpq = priority_queue<T, vector<T>, greater<>>;

template<class T, class U = less<T>>
using rt = __gnu_pbds::tree<T, __gnu_pbds::null_type, U, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<class T>
void dbgh(const T &t) {
	cerr << t << endl;
}

template<class T, class ...U>
void dbgh(const T &t, const U &...u) {
	cerr << t << " | ";
	dbgh(u...);
}

#ifdef DEBUG
#define dbg(...) cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" << ": "; dbgh(__VA_ARGS__)
#else
#define cerr if(false) cerr
#define dbg(...) 1412
#endif

//imagine a language where int = long
#define long int64_t

//typing too hard
#define endl "\n"

#define sz(x) static_cast<int>((x).size())

#define inline inline __attribute__((always_inline))

vector<vector<int>> ways;

void pcomp(int n = 10, vector<int> cur = {}) {
	if(n) {
		int last = sz(cur) ? cur.back() : 0;
		for(int i = last; i < 4; i++) {
			cur.push_back(i);
			pcomp(n - 1, cur);
			cur.pop_back();
		}
	}else {
		ways.push_back(cur);
	}
}

void encode(int n, int arr[]) {
	if(ways.empty()) {
		pcomp();
	}
	assert(sz(ways) == 286);
	for(int i = 0; i < n; i++) {
		for(auto &a: ways[arr[i]]) {
			send((i << 2) | a);
		}
	}
}
#include "encoder.h"
#include "encoderlib.h"
#include "decoder.h"
#include "decoderlib.h"
#include "bits/extc++.h"

using namespace std;

template<class T>
using mpq = priority_queue<T, vector<T>, greater<>>;

template<class T, class U = less<T>>
using rt = __gnu_pbds::tree<T, __gnu_pbds::null_type, U, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<class T>
void dbgh(const T &t) {
	cerr << t << endl;
}

template<class T, class ...U>
void dbgh(const T &t, const U &...u) {
	cerr << t << " | ";
	dbgh(u...);
}

#ifdef DEBUG
#define dbg(...) cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" << ": "; dbgh(__VA_ARGS__)
#else
#define cerr if(false) cerr
#define dbg(...) 1412
#endif

//imagine a language where int = long
#define long int64_t

//typing too hard
#define endl "\n"

#define sz(x) static_cast<int>((x).size())

#define inline inline __attribute__((always_inline))

vector<vector<int>> ways;

void pcomp(int n = 10, vector<int> cur = {}) {
	if(n) {
		int last = sz(cur) ? cur.back() : 0;
		for(int i = last; i < 4; i++) {
			cur.push_back(i);
			pcomp(n - 1, cur);
			cur.pop_back();
		}
	}else {
		ways.push_back(cur);
	}
}

void decode(int n, int m, int arr[]) {
	assert(sz(ways) == 286);
	vector<int> message[n];
	for(int i = 0; i < m; i++) {
		message[arr[i] >> 2].push_back(arr[i] & 3);
	}
	for(int i = 0; i < n; i++) {
		sort(begin(message[i]), end(message[i]));
		auto it = find(begin(ways), end(ways), message[i]);
		output(it - ways.begin());
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 756 KB Execution killed with signal 6
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1108 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1152 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1144 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1156 KB Execution killed with signal 6
2 Runtime error 7 ms 1452 KB Execution killed with signal 6
3 Runtime error 6 ms 1344 KB Execution killed with signal 6
4 Runtime error 9 ms 1516 KB Execution killed with signal 6
5 Runtime error 16 ms 1616 KB Execution killed with signal 6
6 Runtime error 13 ms 1520 KB Execution killed with signal 6
7 Runtime error 13 ms 1520 KB Execution killed with signal 6