제출 #1334579

#제출 시각아이디문제언어결과실행 시간메모리
1334579qilby앵무새 (IOI11_parrots)C++20
0 / 100
3 ms836 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void send(int x);
void output(int x);

void encode(int n, int a[]) {
    int c[n];
    vector < int > b;
    for (int i = 0; i < n; i++) b.push_back(a[i]);

    sort(b.begin(), b.end());
    b.resize(unique(b.begin(), b.end()) - b.begin());

    for (int i = 0; i < n; i++) c[i] = lower_bound(b.begin(), b.end(), a[i]) - b.begin();

    for (int i = 0; i < n; i++) {
        send(a[i]);
        send(a[i]);
        send(a[i]);
        send(a[i]);
    }

    int sl = 0, sh = 0;

    for (int i = 0; i < n; i++) {
        sl += (c[i] % 8) + 1;
        send(sl - 1);
        send(sl - 1);
        sh += (c[i] / 8) + 1;
        send(sh - 1);
    }
}
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void send(int x);
void output(int x);

void decode(int n, int m, int a[]) {
    sort(a, a + m);
    vector < int > v, l, h;

    int i = 0, sl = 0, sh = 0;

    while (i < m) {
        int k = 1;
        while (i + 1 < m && a[i + 1] == a[i]) i++, k++;

        if (k & 4) v.push_back(a[i]);

        int w = a[i] + 1;
        if (k & 2) { l.push_back(w - sl - 1); sl = w; }
        if (k & 1) { h.push_back(w - sh - 1); sh = w; }

        i++;
    }

    for (int i = 0; i < n; i++) output(v[l[i] * h[i] * 8]);
}
#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...