#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int n , int m[]){
int cnt = 0;
for(int i = 0 ; i < n ; i += 1){
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i] & (1<<j)){
cnt += 1;
}
}else{
if(m[i] & (1<<j)){
cnt += 2;
}
}
}
}
if(cnt <= 6*n){
for(int i = 0 ; i < n ; i += 1){
int val = i*4;
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i]&(1<<j)){
send(val+j);
}
}else{
if(m[i]&(1<<j)){
send(val+j-4),send(val+j-4);
}
}
}
}
}else{
send(0),send(0),send(0),send(0);
for(int i = 0 ; i < n ; i += 1){
int val = i*4;
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i]&(1<<j)){
}else{
send(val+j);
}
}else{
if(m[i]&(1<<j)){
}else{
send(val+j-4),send(val+j-4);
}
}
}
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int n , int l , int X[]){
map<int,int> mp;
int ans[n];
for(int i = 0 ; i < l ; i += 1){
mp[X[i]] += 1;
}
for(int i = 0 ; i < n ; i += 1){
ans[i] = 0;
}
if(mp[0] >= 4){
mp[0] -= 4;
for(int i = 0 ; i < n ; i += 1){
ans[i] = (1<<8)-1;
}
}
for(auto i : mp){
int val = i.first%4 , val2 = i.first/4;
if(i.second == 1){
ans[val2] ^= (1<<val);
}else if(i.second == 2){
ans[val2] ^= (1<<(val+4));
}else if(i.second == 3){
ans[val2] ^= (1<<val);
ans[val2] ^= (1<<(val+4));
}
}
for(int i = 0 ; i < n ; i += 1){
output(ans[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1012 KB |
Output is correct |
2 |
Correct |
3 ms |
1012 KB |
Output is correct |
3 |
Correct |
3 ms |
1016 KB |
Output is correct |
4 |
Correct |
3 ms |
1016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1004 KB |
Output is correct |
2 |
Correct |
2 ms |
1012 KB |
Output is correct |
3 |
Correct |
3 ms |
1016 KB |
Output is correct |
4 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1004 KB |
Output is correct |
2 |
Correct |
3 ms |
1016 KB |
Output is correct |
3 |
Correct |
3 ms |
1016 KB |
Output is correct |
4 |
Correct |
5 ms |
1164 KB |
Output is correct |
5 |
Correct |
6 ms |
1164 KB |
Output is correct |
6 |
Correct |
5 ms |
1164 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
3 ms |
1012 KB |
Output is partially correct - P = 6.187500 |
2 |
Partially correct |
5 ms |
1176 KB |
Output is partially correct - P = 6.093750 |
3 |
Partially correct |
6 ms |
1160 KB |
Output is partially correct - P = 6.090909 |
4 |
Partially correct |
10 ms |
1188 KB |
Output is partially correct - P = 6.060000 |
5 |
Partially correct |
10 ms |
1316 KB |
Output is partially correct - P = 6.050000 |
6 |
Partially correct |
10 ms |
1320 KB |
Output is partially correct - P = 6.015873 |
7 |
Partially correct |
10 ms |
1324 KB |
Output is partially correct - P = 6.046875 |