#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); it++)
typedef long long ll;
typedef pair < int, int > ii;
const int inf = 1e9 + 333;
const ll linf = 1e18 + inf;
const int N = 100 + 5;
vector < int > v1, v2;
void encode(int n, int a[]) {
v1.clear();
v2.clear();
for(int i = 0; i < n; i += 2) {
for(int p = 0; p < 8; p++) {
int x = ((a[i] >> p) & 1) * 2 + (i + 1 < n ? ((a[i + 1] >> p) & 1) : 0);
for(int j = 0; j < x; j++)
v1.push_back(i / 2 * 8 + p);
for(int j = 0; j < 3 - x; j++)
v2.push_back(i / 2 * 8 + p);
}
}
if(v1.size() > v2.size()) {
v1.swap(v2);
v1.push_back(255);
v1.push_back(255);
v1.push_back(255);
v1.push_back(255);
}
foreach(it, v1) {
int x = *it;
send(x);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); it++)
typedef long long ll;
typedef pair < int, int > ii;
const int inf = 1e9 + 333;
const ll linf = 1e18 + inf;
const int N = 100 + 5;
int cnt[500];
int ans[N];
void decode(int n, int m, int a[]) {
memset(cnt, 0, sizeof(cnt));
memset(ans, 0, sizeof(ans));
for(int i = 0; i < m; i++)
cnt[a[i]]++;
if(cnt[255] >= 4) {
cnt[255] -= 4;
for(int i = 0; i < 256; i++)
cnt[i] = 3 - cnt[i];
}
for(int i= 0; i < 256; i++) {
int x = i / 8 * 2;
int k = i % 8;
if(cnt[i] & 2)
ans[x] += 1 << k;
if(cnt[i] & 1)
ans[x + 1] += 1 << k;
}
for(int i = 0; i < n; i++) {
//printf("%d ", ans[i]);
output(ans[i]);
}
//puts("");
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1608 KB |
Output is correct |
2 |
Correct |
5 ms |
1816 KB |
Output is correct |
3 |
Correct |
5 ms |
2048 KB |
Output is correct |
4 |
Correct |
5 ms |
2048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2112 KB |
Output is correct |
2 |
Correct |
5 ms |
2144 KB |
Output is correct |
3 |
Correct |
5 ms |
2144 KB |
Output is correct |
4 |
Correct |
5 ms |
2144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2152 KB |
Output is correct |
2 |
Correct |
5 ms |
2152 KB |
Output is correct |
3 |
Correct |
6 ms |
2152 KB |
Output is correct |
4 |
Correct |
7 ms |
2152 KB |
Output is correct |
5 |
Correct |
7 ms |
2152 KB |
Output is correct |
6 |
Correct |
7 ms |
2152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
6 ms |
2152 KB |
Output is partially correct - P = 6.187500 |
2 |
Partially correct |
8 ms |
2152 KB |
Output is partially correct - P = 6.093750 |
3 |
Partially correct |
10 ms |
2152 KB |
Output is partially correct - P = 6.242424 |
4 |
Partially correct |
10 ms |
2400 KB |
Output is partially correct - P = 6.060000 |
5 |
Partially correct |
14 ms |
2440 KB |
Output is partially correct - P = 6.050000 |
6 |
Partially correct |
15 ms |
2440 KB |
Output is partially correct - P = 6.111111 |
7 |
Partially correct |
13 ms |
2440 KB |
Output is partially correct - P = 6.046875 |