제출 #1325409

#제출 시각아이디문제언어결과실행 시간메모리
1325409adiyer앵무새 (IOI11_parrots)C++20
81 / 100
5 ms824 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++){
        int k = (i << 2);
        int f1 = (a[i] >> 6) % 4;
        int f2 = (a[i] >> 4) % 4;
        int f3 = (a[i] >> 2) % 4;
        int f4 = (a[i] >> 0) % 4;
        send((k | f1 | (1 << 7)));
        send((k | f2));
        send((k | f3));
        send((k | f3));
        send((k | f4));
        send((k | f4));
        send((k | f4));
        send((k | f4));
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>

using namespace std;

void decode(int m, int n, int a[]){
    vector < int > pos[m];
    for(int i = 0; i < n; i++) pos[(a[i] >> 2) % 32].push_back(((a[i] % 4) | (a[i] & 128)));
    for(int i = 0; i < m; i++){
        int out = 0;
        int cnt[4] = {};
        for(int x : pos[i]){
            if((x >> 7) & 1) out |= ((x % 4) << 6);
            else cnt[x]++;
        }
        for(int x = 0; x < 4; x++){
            if((cnt[x] & 1)) out |= (x << 4);
            if((cnt[x] & 2)) out |= (x << 2);
            if((cnt[x] & 4)) out |= (x << 0);
        }
        output(out);
    }
}
#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...