제출 #64513

#제출 시각아이디문제언어결과실행 시간메모리
64513IvanC앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void enconder_utility(int qtd_bits,int pos,int number){ vector<int> pos_representation,number_representation; int manda[3] = {1,2,4}; int comeca[3] = {0,3,6}; for(int i = 0;i<qtd_bits;i++){ if(pos & (1 << i)) pos_representation.push_back(1); else pos_representation.push_back(0); } for(int i = 0;i < 8;i++){ if(number & (1 << i)) number_representation.push_back(1); else number_representation.push_back(0); } number_representation.push_back(0); for(int vez = 0;vez<3;vez++){ int vai_mandar = 0; int qual_pot = 1; for(int i = 0;i<pos_representation.size();i++){ vai_mandar += qual_pot*pos_representation[i]; qual_pot *= 2; } for(int i = comeca[vez];i < comeca[vez] + 3;i++){ vai_mandar += qual_pot*number_representation[i]; qual_pot *= 2; } for(int quanto = 0;quanto<manda[vez];quanto++) send(vai_mandar); } } void enconde(int N,int M[]){ int qtd_bits = 0; for(int i = 0;(1 << i) < N;i++) qtd_bits = i + 1; for(int i = 0;i<N;i++){ enconder_utility(qtd_bits,i,M[i]); } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]){ map<int,int> mapa[65]; int ANS[65]; memset(ANS,0,sizeof(ANS)); int qtd_bits = 0; for(int i = 0;(1 << i) < N;i++) qtd_bits = i + 1; for(int i = 0;i < L;i++){ int pos = X[i] & ((1 << qtd_bits) - 1); int outros_bits = (X[i] >> qtd_bits); mapa[pos][outros_bits]++; } for(int i = 0;i<N;i++){ for(auto it : mapa[i]){ int outros_bits = it.first,freq = it.second; if(freq & 1) ANS[i] += outros_bits; if(freq & 2) ANS[i] += outros_bits*8; if(freq & 4) ANS[i] += outros_bits*64; } } for(int i = 0;i<N;i++) output(ANS[i]); }

컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'void enconder_utility(int, int, int)':
encoder.cpp:28:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0;i<pos_representation.size();i++){
                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccf6mZqO.o: In function `main':
grader_encoder.cpp:(.text.startup+0x141): undefined reference to `encode(int, int*)'
collect2: error: ld returned 1 exit status