# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
232303 | Leonardo_Paes | Parrots (IOI11_parrots) | C++11 | 0 ms | 0 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 <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int n , int m[] ){
set<vector<int>> s;
int qtd = 0;
map<int, vector<int>> arr;
for(int i=0; i<4; i++){
for(int j=0; j<4; j++){
for(int k=0; k<4; k++){
for(int l=0; l<4; l++){
for(int m=0; m<4; m++){
for(int n=0; n<4; n++){
for(int o=0; o<4; o++){
for(int p=0; p<4; p++){
for(int q=0; q<4; q++){
for(int r=0; r<4; r++){
vector<int> x;
x.push_back(i);
x.push_back(j);
x.push_back(k);
x.push_back(l);
x.push_back(m);
x.push_back(n);
x.push_back(o);
x.push_back(p);
x.push_back(q);
x.push_back(r);
sort(x.begin(), x.end());
if(s.find(x) == s.end()){
qtd++;
s.insert(x);
arr[qtd] = x;
}
}
}
}
}
}
}
}
}
}
}
for(int i=0; i<n; i++){
int val = 0;
for(int j=0; j<6; j++){
if(m[i] & (1<<j)){
val += (1<<(j+3));
}
}
for(int j=0; j<10; j++){
send(val + arr[val][j]);
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int n , int l, int m[] ){
set<vector<int>> s;
int qtd = 0;
map<int, vector<int>> arr;
map<vector<int>, int> ans;
for(int i=0; i<4; i++){
for(int j=0; j<4; j++){
for(int k=0; k<4; k++){
for(int l=0; l<4; l++){
for(int m=0; m<4; m++){
for(int n=0; n<4; n++){
for(int o=0; o<4; o++){
for(int p=0; p<4; p++){
for(int q=0; q<4; q++){
for(int r=0; r<4; r++){
vector<int> x;
x.push_back(i);
x.push_back(j);
x.push_back(k);
x.push_back(l);
x.push_back(m);
x.push_back(n);
x.push_back(o);
x.push_back(p);
x.push_back(q);
x.push_back(r);
sort(x.begin(), x.end());
if(s.find(x) == s.end()){
qtd++;
s.insert(x);
arr[qtd] = x;
ans[x] = qtd;
}
}
}
}
}
}
}
}
}
}
}
vector<int> x[65];
for(int i=0; i<l; i++){
for(int j=0; j<8; j++){
int val = 0, pos = 0;
if(j<3){
val += m[i] & (1<<j);
}
else{
pos += m[i] & (1<<j);
x[pos].push_back(val);
}
}
}
for(int i=1; i<64; i++){
sort(x[i].begin(), x[i].end());
send(ans[x]);
}
}