Submission #934685

# Submission time Handle Problem Language Result Execution time Memory
934685 2024-02-27T19:24:54 Z tamyte Parrots (IOI11_parrots) C++14
0 / 100
1 ms 1312 KB
#include "encoder.h"
#include "encoderlib.h"

void encode(int N, int M[])
{
  int i;
  for(i=0; i<N; i++) {
    int now = i;
    for (int j = 0; j < 4; ++j) {
        if ((1 << j) & M[i]) {
            now += (1 << (4 + j));
        }
    }
//    std::cout << now << " + ";
    send(now);
    send(now);
    now = i;
    for (int j = 4; j < 8; ++j) {
        if ((1 << j) & M[i]) {
            now += (1 << (j));
        }
    }
//    std::cout << now << "\n";
    send(now);
  }
}
#include "decoder.h"
#include "decoderlib.h"
#include <vector>

void decode(int N, int L, int X[])
{
  int i;
  std::vector<std::vector<int>> res(N, std::vector<int>(2, -1));
  for(i=0; i<L; i++) {
    int num = 0;
    for (int j = (1 << 4); j <= X[i]; j <<= 1) {
        if (j & X[i]) {
            num += (j >> 4);
        }
    }
    int idx = 0;
    for (int j = 0; j < 4; ++j) {
        if ((1 << j) & X[i]) {
            idx += (1 << j);
        }
    }
//    std::cout << idx << " " << num << " <- " << X[i] << "\n";
    if (res[idx][0] != -1) {
        if (res[idx][0] == num) {
            std::swap(res[idx][0], res[idx][1]);
        }
    } else {
        res[idx][0] = num;
    }
  }
  for (int i = 0; i < N; ++i) {
    if (res[i][0] == -1) res[i][0] = 0;
    if (res[i][1] == -1) res[i][1] = 0;
    int num = ((res[i][0] << 4) + res[i][1]);
//    std::cout << i << ": " << res[i][0] << " " << (res[i][1] << 4) << "\n";
    output(num);
  }
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 784 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1312 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1312 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1308 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1308 KB Error : Output is wrong
2 Halted 0 ms 0 KB -