Submission #959230

#TimeUsernameProblemLanguageResultExecution timeMemory
959230d4xnParrots (IOI11_parrots)C++17
24 / 100
11 ms1384 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void encode(int n, int m[]) {
  pair<int, int> a[256];
  
  int curr = 0;
  for (int i = 0; i < 64; i++) {
    for (int j = 0; j < 4; j++) {
      a[curr++] = make_pair(i, j);
    }
  }

  for(int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      int x = m[i] % 4;

      int y = 0;
      while (a[y].first != i || a[y].second != j) {
        y++;
      }

      for (int k = 0; k < x; k++) {
        send(y);
      }

      m[i] /= 4;
    }
  }cerr << endl;
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void decode(int N, int L, int X[]) {
  pair<int, int> a[256];

  int curr = 0;
  for (int i = 0; i < 64; i++) {
    for (int j = 0; j < 4; j++) {
      a[curr++] = make_pair(i, j);
    }
  }

  int pw[4];
  pw[0] = 1;
  for (int i = 1; i < 4; i++) {
    pw[i] = pw[i-1]*4;
  }

  vector<int> ans(N, 0); 
  for (int i = 0; i < L; i++) {
    int x = X[i];
    ans[a[x].first] += pw[a[x].second];
  }

  for (int i = 0; i < N; i++) {
    output(ans[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...