Submission #1332416

#TimeUsernameProblemLanguageResultExecution timeMemory
1332416QuocSenseiParrots (IOI11_parrots)C++20
34 / 100
1 ms836 KiB
#include <bits/stdc++.h>

#define ENCODER
// #define DECODER

#define ll long long 
#define el cout << endl
#define bit(mask, i) (((mask) >> (i)) & 1)
#define BIT(n) ((1ll) << (n))
#define ii pair<int, int>
#define fi first 
#define se second

using namespace std;

void send(int a);
void output(int b);

namespace SUBTASK_1
{
    #ifdef ENCODER
    namespace personA
    {
        void encode(int N, int M[])
        {
            int a = 0;
            for (int i = 0; i < N; i++)
                a += M[i] * BIT(i);
            send(a);
        }
    }
    #endif

    #ifdef DECODER
    namespace personB
    {
        void decode(int N, int L, int X[])
        {
            for (int i = 0; i < N; i++)
                output(bit(X[0], i));
        }
    }
    #endif
}
namespace SUBTASK_2
{
    #ifdef ENCODER
    namespace personA
    {
        void encode(int N, int M[])
        {
            for (int i = 0; i < N; i++)
                send(i * 256 + M[i]);
        }
    }
    #endif
    #ifdef DECODER
    namespace personB
    {
        void decode(int N, int L, int X[])
        {
            vector<ii> pr;
            for (int i = 0; i < L; i++)
                pr.push_back(ii(X[i] / 256, X[i] % 256));
            sort(pr.begin(), pr.end());
            for (int i = 0; i < N; i++)
                output(pr[i].se);
        }
    }
    #endif
}

#ifdef ENCODER
void encode(int N, int M[])
{
    SUBTASK_2::personA::encode(N, M);
}
#endif
#ifdef DECODER
void decode(int N, int L, int X[])
{
    SUBTASK_2::personB::decode(N, L, X);
}
#endif
#include <bits/stdc++.h>

// #define ENCODER
#define DECODER

#define ll long long 
#define el cout << endl
#define bit(mask, i) (((mask) >> (i)) & 1)
#define BIT(n) ((1ll) << (n))
#define ii pair<int, int>
#define fi first 
#define se second

using namespace std;

void send(int a);
void output(int b);

namespace SUBTASK_1
{
    #ifdef ENCODER
    namespace personA
    {
        void encode(int N, int M[])
        {
            int a = 0;
            for (int i = 0; i < N; i++)
                a += M[i] * BIT(i);
            send(a);
        }
    }
    #endif

    #ifdef DECODER
    namespace personB
    {
        void decode(int N, int L, int X[])
        {
            for (int i = 0; i < N; i++)
                output(bit(X[0], i));
        }
    }
    #endif
}
namespace SUBTASK_2
{
    #ifdef ENCODER
    namespace personA
    {
        void encode(int N, int M[])
        {
            for (int i = 0; i < N; i++)
                send(i * 256 + M[i]);
        }
    }
    #endif
    #ifdef DECODER
    namespace personB
    {
        void decode(int N, int L, int X[])
        {
            vector<ii> pr;
            for (int i = 0; i < L; i++)
                pr.push_back(ii(X[i] / 256, X[i] % 256));
            sort(pr.begin(), pr.end());
            for (int i = 0; i < N; i++)
                output(pr[i].se);
        }
    }
    #endif
}

#ifdef ENCODER
void encode(int N, int M[])
{
    SUBTASK_2::personA::encode(N, M);
}
#endif
#ifdef DECODER
void decode(int N, int L, int X[])
{
    SUBTASK_2::personB::decode(N, L, X);
}
#endif
#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...