Submission #246386

#TimeUsernameProblemLanguageResultExecution timeMemory
246386luisoncppParrots (IOI11_parrots)C++17
24 / 100
18 ms1792 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> SplitInto2Bit(int N, int* message) { Vec<int> ret; for (int i = 0; i < N; ++i) { for (int k = 0; k < 4; ++k) { int a = (message[i]>>(2*k)); ret.push_back(a&3); } } return ret; } void encode(int N, int* message_8) { auto message = SplitInto2Bit(N, message_8); for (int i = 0; i < message.size(); ++i) { int num = message[i]; assert(num>=0 && num<4); int times = num; while (times--) { send(i); } } }
#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_2_bit(4*N); std::unordered_map<int, int> Count; for (int i = 0; i < L; ++i) { ++decoded_2_bit.at(X[i]); } for (int i = 0; i < 4*N; i += 4) { int num = 0; for (int k = 0; k < 4; ++k) { num |= (decoded_2_bit.at(i + k)<<(2*k)); } output(num); } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:31: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...