Submission #1325452

#TimeUsernameProblemLanguageResultExecution timeMemory
1325452adiyer앵무새 (IOI11_parrots)C++20
24 / 100
6 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;
        for(int i = 0; i < f1; i++) send((k | 0));
        for(int i = 0; i < f2; i++) send((k | 1));
        for(int i = 0; i < f3; i++) send((k | 2));
        for(int i = 0; i < f4; i++) send((k | 3));
    }
}
#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)].push_back((a[i] % 4));
    for(int i = 0; i < m; i++){
        int out = 0;
        int cnt[4] = {};
        for(int bit : pos[i]) cnt[bit]++;
        for(int bit = 0; bit < 4; bit++) out |= (cnt[bit] << (6 - bit * 2));
        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...