제출 #351898

#제출 시각아이디문제언어결과실행 시간메모리
351898talant117408앵무새 (IOI11_parrots)C++17
24 / 100
11 ms1460 KiB
#include "encoder.h"
#include "encoderlib.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;

void encode(int N, int M[]){
    for(int i = 0; i < N; i++){
        int num = i;
        for(int bit = 0; bit < 4; bit++){
            if(M[i]&(1<<bit)){
                if(!bit) send(num);
                else if(bit == 1) send(num+64);
                else if(bit == 2) send(num+128);
                else send(num+192);
            }
        }
        for(int bit = 0; bit < 4; bit++){
            if(M[i]&(1<<(bit+4))){
                if(!bit){
                    send(num);
                    send(num);
                }
                else if(bit == 1){
                    send(num+64);
                    send(num+64);
                }
                else if(bit == 2){
                    send(num+128);
                    send(num+128);
                }
                else{
                    send(num+192);
                    send(num+192);
                }
            }
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;

void decode(int N, int L, int X[]){
    vector <int> cnt(256), ans(N);
    for(int i = 0; i < L; i++){
        cnt[X[i]]++;
    }
    for(int i = 0; i < 256; i++){
        if(cnt[i] > 1){
            cnt[i] -= 2;
            int ind = 0, which = 0;
            for(int bit = 0; bit < 6; bit++){
                if(i&(1<<bit)) ind |= (1<<bit);
            }
            if((i&(1<<6)) && (i&(1<<7))) which = 7;
            else if(i&(1<<7)) which = 6;
            else if(i&(1<<6)) which = 5;
            else which = 4;
            ans[ind] |= (1<<which);
        }
        if(cnt[i]){
            cnt[i]--;
            int ind = 0, which = 0;
            for(int bit = 0; bit < 6; bit++){
                if(i&(1<<bit)) ind |= (1<<bit);
            }
            if((i&(1<<6)) && (i&(1<<7))) which = 3;
            else if(i&(1<<7)) which = 2;
            else if(i&(1<<6)) which = 1;
            else which = 0;
            ans[ind] |= (1<<which);
        }
    }
    for(auto to : ans) output(to);
}
/*
8
0 0 1 1 0 0 1 0

6 
1 255 13 26 49 216
*/
#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...