| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 583560 | benson1029 | 앵무새 (IOI11_parrots) | C++14 | 132 ms | 13808 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;
namespace encoder_var {
int faken;
int a[1005];
vector< vector<int> > v;
void perm(vector<int> x, int curr) {
if(v.size()==65536) return;
if(x.size()==12) {
v.push_back({});
for(int i:x) {
if(i!=-1) v[v.size()-1].push_back(i);
}
return;
}
for(int i=curr; i<8; i++) {
x.push_back(i);
perm(x, i);
x.pop_back();
}
}
};
void encode(int N, int M[])
{
using namespace encoder_var;
perm({}, -1);
for(int i=0; i<N; i+=2) {
int value;
if(i==N-1) {
value = M[i];
} else {
value = M[i] + M[i+1] * 256;
}
int init = i/2*8;
for(int j=0; j<v[value].size(); j++) {
send(v[value][j]+init);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
namespace decoder_var {
int faken;
int a[1005];
vector< vector<int> > v;
vector<int> tmp;
void perm(vector<int> x, int curr) {
if(v.size()==65536) return;
if(x.size()==12) {
v.push_back({});
for(int i:x) {
if(i!=-1) v[v.size()-1].push_back(i);
}
return;
}
for(int i=curr; i<8; i++) {
x.push_back(i);
perm(x, i);
x.pop_back();
}
}
};
void decode(int N, int L, int X[])
{
using namespace decoder_var;
sort(X, X+L);
int ptr = 0;
perm({}, -1);
for(int i=0; i<64; i+=2) {
int init = i/2*8;
tmp.clear();
while(ptr<L && X[ptr]<init+8) {
tmp.push_back(X[ptr]-init);
++ptr;
}
for(int j=0; j<v.size(); j++) {
if(v[j] == tmp) {
a[i+1] = j/256;
a[i] = j%256;
break;
}
}
}
for(int i=0; i<N; i++) output(a[i]);
}
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... | ||||
