# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17129 | murat | Parrots (IOI11_parrots) | C++98 | 12 ms | 2432 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;
void encode(int N, int M[]) {
int c = 0, t;
vector< int > v[5];
int P[500] = {0};
int cc[2][500] = {0};
memset(P, 0, sizeof P);
memset(cc, 0, sizeof cc); c = 0;
for(int i=0; i<N; i++) {
int tt = M[i];
for(int j = 0; j < 8; j+=2) {
P[c] = (tt >> (6-j)) & 3;
cc[1][3-P[c]]++;
cc[0][P[c]]++;
c++;
}
}
int t1 = cc[0][1] + cc[0][1] * 2 + cc[0][3] * 3;
int t2 = cc[1][1] + cc[1][2] * 2 + cc[1][3] * 3;
int w = 0;
if(t2 < t1) w = 1;
send(w); send(w);
send(w); send(w);
for(int i = 0; i < c; i++) {
if(w) P[i] = 3 - P[i];
while(P[i]--) {
send(i);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
int cc[500] = {0}, t = 0;
memset(cc, 0, sizeof cc);
t = 0;
for(int i=0; i<L; i++) cc[X[i]]++;
int w = 0;
if(cc[0] > 3) { cc[0] -= 4; w = 0;}
if(cc[1] > 3) { cc[1] -= 4; w = 1;}
for(int i = 0; i < N * 4; i++) {
if(w) cc[i] = 3 - cc[i];
if(i % 4 == 3) {
int t = 64 * cc[i-3] + 16 * cc[i-2] + 4 * cc[i-1] + cc[i];
output(t);
}
}
}
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... |