# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411238 | AugustinasJucas | Parrots (IOI11_parrots) | C++14 | 11 ms | 1336 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>
using namespace std;
#include "encoder.h"
#include "encoderlib.h"
void encode(int n, int M[]){
vector<int> vec;
for(int i = 0; i < n; i++){
auto x = M[i];
for(int i = 7; i > -1; i--){
vec.push_back((bool)((1 << i) & x));
}
}
//cout << "vec: \n"; for(auto x : vec) cout << x << " "; cout << endl;
vector<int> pos[2];
for(int i = 0; i < vec.size(); i += 2){
int st = vec[i] * 2 + vec[i+1];
for(int j = 0; j < st; j++) pos[0].push_back(i/2);
for(int j = 0; j < 3-st; j++) pos[1].push_back(i/2);
}
for(int i = 0; i < 4; i++) pos[1].push_back(255);
//cout << "darom 0: " << (pos[0].size() < pos[1].size()) << endl;
if(pos[0].size() < pos[1].size()){
for(auto x : pos[0]) send(x);
}else{
for(auto x : pos[1]) send(x);
}
}
#include <bits/stdc++.h>
using namespace std;
#include "decoder.h"
#include "decoderlib.h"
void decode(int n, int l, int X[]){
int kek[10000] = {};
for(int i = 0; i < l; i++) kek[X[i]]++;
vector<bool> vec(8*n);
for(int i = 0; i < 8*n; i += 2){
int st = kek[i/2];
if(st >= 4) st -= 4;
if(kek[255] >= 4) st = 3 - st;
vec[i] = (st & 2)/2;
vec[i+1] = st & 1;
}
// cout << "gaunu vec: \n"; for(auto x : vec) cout << x << " "; cout << endl;
for(int i =0; i < vec.size(); i += 8){
int st = 0;
for(int j = 0; j < 8; j++) st += (int)vec[i+7-j] * (1 << j);
// cout << "st: " << st << endl;
output(st);
}
}
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... |