제출 #248533

#제출 시각아이디문제언어결과실행 시간메모리
248533A02앵무새 (IOI11_parrots)C++14
17 / 100
4 ms1792 KiB
#include "encoder.h" #include "encoderlib.h" #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <set> #include <utility> #include <string> using namespace std; void encode(int N, int M[]) { vector<bool> message; for(int i = 0; i < N; i++){ for (int j = 7; j >= 0; j--){ message.push_back((M[i] & (1 << j))); } } // for (int i = 0; i < N; i++){ // cout << M[i] << ' '; // } // cout << endl; // // for (int i = 0; i < message.size(); i++){ // cout << message[i] << ' ';; // } // cout << endl; for (int i = 0; i < 2 * N; i++){ int to_send = 8 * message[4 * i] + 4 * message[4 * i + 1] + 2 * message[4 * i + 2] + message[4 * i + 3]; for (int k = 0; k < 4; k++){ if (to_send >= 3){ to_send -= 3; send(4 * i + 3); } else { if (to_send == 2){ to_send -=2; send(4 * i + 2); } else{ if (to_send == 1){ to_send -=1; send(4 * i + 1); } else{ send(4 * i); } } } } } }
#include "decoder.h" #include "decoderlib.h" #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <set> #include <utility> using namespace std; //bool pairc void decode(int N, int L, int X[]) { vector<pair<int, int> > recieved; vector<int> full_recieved; for(int i=0; i<L; i++) { recieved.push_back(make_pair(X[i] >> 2, X[i] & 3)); } sort(recieved.begin(), recieved.end()); for (int i = 0; i < recieved.size(); i++){ //cout << recieved[i].first << " : " << recieved[i].second << endl; full_recieved.push_back(recieved[i].second); //cout << 'r' << recieved[i].second << endl; } for (int i = 0; i < N; i++){ int s1 = full_recieved[8 * i]; int s2 = full_recieved[8 * i + 1]; int s3 = full_recieved[8 * i + 2]; int s4 = full_recieved[8 * i + 3]; int t1 = full_recieved[8 * i + 4]; int t2 = full_recieved[8 * i + 5]; int t3 = full_recieved[8 * i + 6]; int t4 = full_recieved[8 * i + 7]; output(((s1 + s2 + s3 + s4) << 4) + (t1 + t2 + t3 + t4)); } }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:26:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < recieved.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...