Submission #246124

#TimeUsernameProblemLanguageResultExecution timeMemory
246124luisoncppParrots (IOI11_parrots)C++17
34 / 100
12 ms1536 KiB
#include <algorithm> #include <iostream> #include <vector> #include <cstdint> #include <cstdlib> #include <cassert> #include <queue> #include <unordered_map> #define PARROTS #ifndef PARROTS_MAIN #include "encoder.h" #include "encoderlib.h" #endif template<typename T> using Vec = std::vector<T>; Vec<int> SplitInto4Bit(int N, int* message) { Vec<int> ret; for (int i = 0; i < N; ++i) { ret.push_back(message[i]&15); ret.push_back(message[i]>>4); } return ret; } void encode(int N, int* message_8) { auto message = SplitInto4Bit(N, message_8); for (int i = 0; i < message.size(); ++i) { send(message[i] | (i<<4)); } }
#include <algorithm> #include <iostream> #include <vector> #include <cstdint> #include <cstdlib> #include <cassert> #include <queue> #include <unordered_map> #ifndef PARROTS_MAIN #include "decoder.h" #include "decoderlib.h" #endif #ifndef PARROTS template<typename T> using Vec = std::vector<T>; #endif void decode(int N, int L, int* X) { Vec<int> decoded_4_bit(2*N); for (int i = 0; i < L; ++i) { int index = (X[i] >> 4); int value = (X[i] & 15); decoded_4_bit[index] = value; } for (int i = 0; i < L; i += 2) { int num = (decoded_4_bit[i] | (decoded_4_bit[i + 1]<<4)); output(num); } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < message.size(); ++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...