Submission #227732

#TimeUsernameProblemLanguageResultExecution timeMemory
227732muhammad_hokimiyonParrots (IOI11_parrots)C++14
52 / 100
11 ms1632 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>

using namespace std;

void encode(int n, int a[])
{
    for( int i = 0; i < n; i++ ){
        for( int j = 0; j < 4; j++ ){
            int res = i;
            res += (j << 4);
            for( int h = 6; h < 8; h++ ){
                if( ((a[i] >> (j * 2 + h - 6)) & 1) ){
                    res += (1 << h);
                }
            }
            send( res );
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>

using namespace std;

void decode(int n, int l, int a[])
{
    vector < vector < int > > b(n , vector < int > (4));
    for( int i = 0; i < l; i++ ){
        int x = 0;
        for( int j = 0; j < 4; j++ ){
            if( ((a[i] >> j) & 1) ){
                x ^= (1 << j);
            }
        }
        int y = 0;
        for( int j = 4 , h = 0; j < 6; j++,h++ ){
            int z = ((a[i] >> j) & 1);
            if( z )y ^= (1 << h);
        }
        int z = 0;
        for( int j = 6 , h = 0; j < 8; j++,h++ ){
            if( ((a[i] >> j) & 1) )z ^= (1 << h);
        }
        b[x][y] = z;
    }
    for( int i = 0; i < n; i++ ){
        int x = 0;
        for( int j = 0 , h = 0; j < 4; j++ ){
            x ^= (b[i][j] << (j * 2));
        }
        output( x );
    }
}

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:30:26: warning: unused variable 'h' [-Wunused-variable]
         for( int j = 0 , h = 0; j < 4; j++ ){
                          ^
#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...