# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146933 | popovicirobert | Parrots (IOI11_parrots) | C++14 | 14 ms | 2032 KiB |
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 <bits/stdc++.h>
using namespace std;
static vector < vector <int> > arr;
static void bfs() {
vector < vector <int> > Q;
int beg = 0;
for(int i = 0; i < 4; i++) {
Q.push_back({i});
}
while(1) {
vector <int> cur = Q[beg++];
arr.push_back(cur);
if(arr.size() >= 256) {
break;
}
for(int i = 0; i < 4; i++) {
if(cur.back() <= i) {
vector <int> aux = cur;
aux.push_back(i);
Q.push_back(aux);
}
}
}
}
void encode(int n, int M[]) {
bfs();
for(int i = 0; i < n; i++) {
int cur = (i << 2);
for(auto it : arr[M[i]]) {
send(it + cur);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
static vector < vector <int> > arr;
static void bfs() {
vector < vector <int> > Q;
int beg = 0;
for(int i = 0; i < 4; i++) {
Q.push_back({i});
}
while(1) {
vector <int> cur = Q[beg++];
arr.push_back(cur);
if(arr.size() >= 256) {
break;
}
for(int i = 0; i < 4; i++) {
if(cur.back() <= i) {
vector <int> aux = cur;
aux.push_back(i);
Q.push_back(aux);
}
}
}
}
void decode(int n, int l, int X[]) {
bfs();
vector < vector <int> > pos(n);
for(int i = 0; i < l; i++) {
pos[X[i] >> 2].push_back(X[i] & 3);
}
for(int i = 0; i < n; i++) {
sort(pos[i].begin(), pos[i].end());
for(int j = 0; j < arr.size(); j++) {
if(arr[j] == pos[i]) {
output(j);
break;
}
}
}
}
Compilation message (stderr)
# | 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... |