Submission #204005

#TimeUsernameProblemLanguageResultExecution timeMemory
204005dung11112003Parrots (IOI11_parrots)C++11
81 / 100
14 ms2040 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

static mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

void encode(int N, int M[])
{
    int n = N;
    int *a = M;
    bool bt[1 << 8] = {0};
    for0(i, n)
    {
        for0(j, 8)
        {
            bt[i * 8 + j] = (a[i] >> j & 1);
        }
    }
    for0(i, n * 8)
    {
        if (bt[i])
        {
            send(i);
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

static mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

void decode(int N, int L, int X[])
{
    int n = N, m = L;
    int *pos = X;
    bool bt[1 << 8] = {0};
    for0(i, m)
    {
        bt[pos[i]] = 1;
    }
    for0(i, n)
    {
        int a = 0;
        for0(j, 8)
        {
            a |= bt[i * 8 + j] << j;
        }
        output(a);
    }
}
#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...