제출 #232964

#제출 시각아이디문제언어결과실행 시간메모리
232964Zex앵무새 (IOI11_parrots)C++11
81 / 100
12 ms1536 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; int append( int x, int i ){ return 100*x+i; } void encode( int N, int M[] ){ /* IDEA 4 : Generate 'matrix' where rows are the numbers themselves. Foreach 1 in the matrix : ( xi, yi ) 0 <= xi < 32 0 <= yi < 8 represent pair( xi, yi ) as [ xxxxx yyy ] */ // cout << endl << "ENCODER" << endl; int mtx[N] = {}; for(int i=0;i<N;i++){ for(int j=0;j<8;j++) mtx[i] |= M[i] & ( 1 << j ); } vector <int> pairs; // for(int i=0;i<N;i++) cout << bitset<8>(mtx[i]) << endl; // cout << endl; for(int i=0;i<N;i++) for(int j=0;j<8;j++) if( mtx[i] & ( 1 << j ) ) pairs.push_back( ( i << 3 ) | j ); // for(int i=0;i<pairs.size();i++) cout << bitset<8>(pairs[i]) << endl; for(int i=0;i<pairs.size();i++) send( pairs[i] ); }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode( int N, int L, int X[] ){ /* IDEA 4 : Generate 'matrix' where rows are the numbers themselves. Foreach 1 in the matrix : ( xi, yi ) 0 <= xi < 32 0 <= yi < 8 represent pair( xi, yi ) as [ xxxxx yyy ] */ // cout << endl << "DECODER" << endl; int mtx[N] = {}; for(int i=0;i<L;i++){ int xi = 0, yi = 0; for(int j=7;j>=3;j--) xi |= X[i] & ( 1 << j ); xi >>= 3; for(int j=2;j>=0;j--) yi |= X[i] & ( 1 << j ); mtx[xi] |= 1 << yi; // cout << xi << ' ' << yi << endl; } // for(int i=0;i<N;i++) cout << bitset<8>(mtx[i]) << endl; for(int i=0;i<N;i++) output(mtx[i]); }

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

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