# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
61093 | mhnd | 앵무새 (IOI11_parrots) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
void encode(int N, int M[]) {
if(N<=32){
for(int i=0;i<N;i++)
for(int k=0;k<8;k++)
if((M[i]>>k)&1)send(N*k+i);
}else{
for (int i = 0; i < N && i < 32; i++) {
for (int j = 0, k = 1; j < 8; j++, k <<= 1) {
if (N > 32 && i + 32 < N) {
if ((M[i] & k) && (M[i + 32] & k)) {
send(i * 8 + j);
} else if (M[i + 32] & k) {
send(i * 8 + j);
send(i * 8 + j);
send(i * 8 + j);
} else if (M[i] & k) {
send(i * 8 + j);
send(i * 8 + j);
}
} else {
if (M[i] & k) {
send(i * 8 + j);
}
}
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
int num[200],f[300];
void decode(int N, int L, int X[]){
memset(num,0,sizeof(num));
memset(f,0,sizeof(f));
if(N<=32){
for(int i=0;i<L;i++)num[X[i]%N] += (1<<(X[i]/N));
}else{
int bitCount[256] = {0};
for (int i = 0; i < L; i++) {
bitCount[X[i]]++;
}
for (int i = 0; i < 256; i++) {
if (N > 32) {
switch (bitCount[i]) {
case 2:
message[i / 8] |= (1 << (i % 8));
break;
case 3:
message[i / 8 + 32] |= 1 << (i % 8);
break;
case 1:
message[i / 8 + 32] |= 1 << (i % 8);
message[i / 8] |= 1 << (i % 8);
break;
}
} else if (bitCount[i]) {
message[i / 8] |= (1 << (i % 8));
}
}
}
for(int i=0;i<N;i++)output(num[i]);
}