이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
for(int i=0;i<min(N,32);i++){
int st = i;
int tmpst = 0;
vector<int> bitss(8);
for(int j=4;j>=0;j--){
if(st&(1<<j)){
bitss[3+j]=1;
}
}
for(int k=0;k<=7;k++){
if(bitss[k]){
tmpst += (1<<k);
}
}
for(int j=0;j<=7;j++){
if(M[i]&(1<<j)){
vector<int> tmp = bitss;
for(int k=0;k<3;k++){
if((1<<k)&j){
tmp[k]=1;
}
}
int num = 0;
for(int k=0;k<=7;k++){
if(tmp[k]==0) continue;
num += (1<<k);
}
send(num);
}
}
}
for(int i=32;i<min(N,64);i++){
int st = i^32;
int tmpst = 0;
vector<int> bitss(8);
for(int j=4;j>=0;j--){
if(st&(1<<j)){
bitss[3+j]=1;
}
}
for(int k=0;k<=7;k++){
if(bitss[k]){
tmpst += (1<<k);
}
}
for(int j=0;j<=7;j++){
if(M[i]&(1<<j)){
vector<int> tmp = bitss;
for(int k=0;k<3;k++){
if((1<<k)&j){
tmp[k]=1;
}
}
int num = 0;
for(int k=0;k<=7;k++){
if(tmp[k]==0) continue;
num += (1<<k);
}
send(num);
send(num);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
vector<int> v(N+5);
int lol = (1<<7) | (1<<6) | (1<<5) | (1<<4) | (1<<3);
int l2 = 1 | (1<<1) | (1<<2);
map<int,int> mp;
for(int i=0;i<L;i++){
mp[X[i]]++;
}
for(auto z:mp){
if(z.second==1){
int pos = (z.first&(lol))>>3;
int bit = z.first&l2;
int val = (1<<bit);
v[pos] = v[pos] | val;
}else if(z.second==2){
int pos = (z.first&(lol))>>3;
pos = pos | 32;
int bit = z.first&l2;
int val = (1<<bit);
v[pos] = v[pos] | val;
}else{
int pos = (z.first&(lol))>>3;
int bit = z.first&l2;
int val = (1<<bit);
v[pos] = v[pos] | val;
pos = pos | 32;
v[pos] = v[pos] | val;
}
}
for(int i=0;i<N;i++) output(v[i]);
}
# | 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... |