Submission #232956

#TimeUsernameProblemLanguageResultExecution timeMemory
232956ZexParrots (IOI11_parrots)C++11
52 / 100
11 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 3 : For every number Mi[ xxxxxxxx ] Produce four numbers Ei[ xxxx yy zz ] where 0 <= xxxx < 16 , 0 <= yy < 4 , 0 <= zz < 4 xxxx is i in binary form zz is bit 2*yy and bit 2*yy+1 from Mi */ // for(int i=0;i<N;i++){ // cout << M[i] << ' ' << bitset<8>(M[i]) << endl; // } for(int i=0;i<N;i++){ int S = i << 4; for(int j=0;j<4;j++){ int xxxx = i << 4; int yy = j << 2; bool a = ( M[i] & ( 1 << 2*j ) ); bool b = ( M[i] & ( 1 << (2*j+1) ) ); int Sv = xxxx | yy | a | (b<<1); send( Sv ); // std::cout << std::bitset<8>(Sv) << std::endl; } } // std::cout << std::endl; }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]){ /* IDEA 3 : For every number Mi[ xxxxxxxx ] Produce four numbers Ei[ xxxx yy zz ] where 0 <= xxxx < 16 , 0 <= yy < 4 , 0 <= zz < 4 xxxx is i in binary form zz is bit 2*yy and bit 2*yy+1 from Mi */ int A[N] = {}; for(int i=0;i<L;i++){ int x = X[i]; int idx = 0; for(int j=7;j>=4;j--) idx |= x & ( 1 << j ); idx >>= 4; int part = 0; for(int j=3;j>=2;j--) part |= x & ( 1 << j ); part >>= 2; int msg = 0; for(int j=1;j>=0;j--) msg |= x & ( 1 << j ); A[idx] |= msg << (2*part); // std::cout << std::bitset<8>(x) << std::endl; // std::cout << std::bitset<4>(idx) << ' ' << std::bitset<2>(part) << ' ' << std::bitset<2>(msg) << std::endl; } // for(int i=0;i<N;i++) cout << bitset<8>(A[i]) << endl; for(int i=0;i<N;i++) output( A[i] ); }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:26:7: warning: unused variable 'S' [-Wunused-variable]
   int S = i << 4;
       ^
#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...