This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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());
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |