제출 #1280155

#제출 시각아이디문제언어결과실행 시간메모리
1280155darele앵무새 (IOI11_parrots)C++20
81 / 100
3 ms844 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { // Subtarea 1 y 2 // for (int i = 0; i < N; i++) { // send(M[i] + 256 * i); // } // Subtarea 1, 2, 3 y 4 // Enviar la posicion de los bits encencidos y separar en grupos de 8 bits // for(int i = 0; i < N; i++) { // int j = 0; // while (j < 8) { // if (M[i] & (1 << j)) { // send(8*i + j); // } // j++; // } // } // Subtarea 5 // Usar los primeros 3 bits para la posicion de los bits encendidos // Usar los ultimos 5 bits para la posicion // Hacer un envio por cada bit encendido // Por ejemplo si el tercer elemento tiene el segundo bit encencido, enviar 011 00010 for(int i = 0; i < N; i++) { int j = 0; while (j < 8) { if (M[i] & (1 << j)) { send((i << 3) + j); } j++; } } }
#include "decoder.h" #include "decoderlib.h" #include <algorithm> #include <vector> #include <iostream> // for debugging using namespace std; void decode(int N, int L, int X[]) { // Subtarea 1 y 2 // sort(X, X + L); // for (int i = 0; i < N; i++) { // output(X[i] % 256); // } // Subtarea 1, 2, 3 y 4 // vector<int> ans(N, 0); // sort(X, X + L); // for (int i = 0; i < L; i++) { // ans[X[i] / 8] |= (1 << (X[i] % 8)); // } // for (int i : ans) { // output(i); // } //Subtarea 5 vector<int> ans(N, 0); for (int i = 0; i < L; i++) { int pos = (X[i] & ((1 << 3) - 1)); ans[X[i] >> 3] |= (1 << pos); } for (int i : ans) { output(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...