Submission #1117436

#TimeUsernameProblemLanguageResultExecution timeMemory
1117436lucascgarParrots (IOI11_parrots)C++17
0 / 100
2 ms1300 KiB
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"


using namespace std;

/*
tenho 8 bits
separar cada numero em seus bits:
posição 0-indexada (vai até 63) (usa 6 bits)
quantidade de left-shifts (vai até 7) (usa 3 bits)
falta 1 bit

com N até 32 dá tranquilo

*/

typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;

const int MAXN=64;

void encode(int n, int M[]){

    for (int i=0;i<n;i++){
        
        for (int qnt=0, b=1;b<=M[i];qnt++,b<<=1) if ((b&M[i])){
            int msg = 0;
            msg = msg&i;  // posição 0-indexada (primeiros 5 bits pra 32)
            msg = msg&(qnt<<5);
            send(msg);
        }
    }
}

#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"

using namespace std;

/*
*/

typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;

const int MAXN=64;

void decode(int n, int l, int x[]){

    vector<int> fnl(n, 0);

    for (int i=0;i<l;i++){
        int msg = x[i], qnt = msg>>5, pos = msg-qnt;
        fnl[pos] = fnl[pos]|1<<qnt;
    }
    for (auto &x:fnl) output(x);

}

#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...