제출 #36360

#제출 시각아이디문제언어결과실행 시간메모리
36360funcsr앵무새 (IOI11_parrots)C++14
81 / 100
12 ms2432 KiB
#include <iostream>
#include <vector>
#include <queue>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
#define INF 1145141919
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define _1 first
#define _2 second
typedef pair<int, int> P;

void encode(int N, int A[]) {
  if (N <= 32) {
    rep(i, N) rep(j, 8) if ((A[i]>>j)&1) send((i<<3) | j);;
  }
  else {
    rep(i, N) rep(j, 4) rep(_, (A[i]>>(2*j))&0b11) send((i<<2) | j);
  }
}
#include <iostream>
#include <vector>
#include <queue>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
#define INF 1145141919
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define _1 first
#define _2 second
typedef pair<int, int> P;

int A[64];
int C[256];
void decode(int N, int L, int X[]) {
  //rep(i, N) rep(j, 4) rep(_, (A[i]>>(2*j))&0b11) send((i<<2) | j);
  rep(i, 256) C[i] = 0;
  rep(i, L) C[X[i]]++;

  rep(i, N) A[i] = 0;
  if (N <= 64) {
    rep(i, 256) {
      int j = i&0b111;
      int pos = i>>3;
      A[pos] |= C[i]<<j;
    }
  }
  else {
    rep(i, 256) {
      int j = i&0b11;
      int pos = i>>2;
      A[pos] |= C[i]<<(2*j);
    }
  }
  rep(i, N) output(A[i]);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...