이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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++) {
    a[curr++] = make_pair(i, -1);
    for (int j = 0; j < 3; j++) {
      a[curr++] = make_pair(i, j);
    }
  }
  for(int i = 0; i < n; i++) {
    vector<int> b(3, 0);
    for (int j = 0; j < 3; j++) {
      b[j] = m[i] % 7;
      m[i] /= 7;
    }
    int sum = b[0] + b[1] + b[2];
    if (sum <= 18 - sum) {
      int y = 0;
      while (a[y].first != i || a[y].second != 0) y++;
      for (int j = 0; j < b[0]; j++) send(y);
      for (int j = 0; j < b[1]; j++) send(y+1);
      for (int j = 0; j < b[2]; j++) send(y+2);
    }
    else {
      int y = 0;
      while (a[y].first != i || a[y].second != -1) y++;
      send(y);
      for (int j = 0; j < 6-b[0]; j++) send(y+1);
      for (int j = 0; j < 6-b[1]; j++) send(y+2);
      for (int j = 0; j < 5-b[2]; j++) send(y+3);
    }
  }
}
#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++) {
    a[curr++] = make_pair(i, -1);
    for (int j = 0; j < 3; j++) {
      a[curr++] = make_pair(i, j);
    }
  }
  int pw[3];
  pw[0] = 1;
  for (int i = 1; i < 3; i++) {
    pw[i] = pw[i-1]*7;
  }
  vector<int> ans(N, 0), rev(N, 0); 
  for (int i = 0; i < L; i++) {
    int x = X[i];
    if (a[x].second == -1) {
      rev[a[x].first] = 1;
      ans[a[x].first] = pw[0]*6 + pw[1]*6 + pw[2]*5;
    }
  }
  for (int i = 0; i < L; i++) {
    int x = X[i];
    if (a[x].second == -1) continue;
    ans[a[x].first] += (rev[a[x].first] ? -pw[a[x].second] : pw[a[x].second]);
  }
  for (int i = 0; i < N; i++) {
    output(ans[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... |