제출 #232969

#제출 시각아이디문제언어결과실행 시간메모리
232969Zex앵무새 (IOI11_parrots)C++11
81 / 100
13 ms1792 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode( int N, int M[] ){ /* IDEA 5 : Generate 'matrix' where rows are the numbers themselves. Foreach 1 in the matrix : ( xi%32, yi ) 0 <= xi < 32 0 <= yi < 8 represent pair( xi, yi ) as [ xxxxx yyy ] if x >= 32 then send the pair twice */ // 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; int N1 = min( N, 32 ); for(int i=0;i<N1;i++) for(int j=0;j<8;j++) if( mtx[i] & ( 1 << j ) ) pairs.push_back( ( i << 3 ) | j ); for(int i=32;i<N;i++) for(int j=0;j<8;j++) if( mtx[i] & ( 1 << j ) ) pairs.push_back( ( (i%32) << 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 5 : Generate 'matrix' where rows are the numbers themselves. Foreach 1 in the matrix : ( xi%32, yi ) 0 <= xi < 32 0 <= yi < 8 represent pair( xi, yi ) as [ xxxxx yyy ] if x >= 32 then send the pair twice */ // cout << endl << "DECODER" << endl; int freq[256] = {}; for(int i=0;i<L;i++) freq[X[i]]++; 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; if( freq[X[i]] == 2 ) xi += 32; 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...