Submission #1030716

# Submission time Handle Problem Language Result Execution time Memory
1030716 2024-07-22T09:03:03 Z coolboy19521 Data Transfer (IOI19_transfer) C++17
0 / 100
2 ms 1040 KB
#include "transfer.h"

using namespace std;

vector<int> get_attachment(vector<int> source) {
    int n = source.size();
    int xs = 0;

    for (int i = 1; i <= n; i ++)
        xs ^= source[i - 1] * i;

    vector<int> v;
    if (63 == n)
        for (int i = 0; i < 7; i ++)
            v.push_back(xs & (1 << i));
    else
        for (int i = 0; i < 9; i ++)
            v.push_back(xs & (1 << i));
    return v;
}

vector<int> retrieve(vector<int> data) {
    vector<int> v;
    int m = data.size();
    int xs = 0;
    if (70 == m) {
        for (int i = 63; i < 70; i ++)
            xs |= data[i] * (1 << (i - 63));
        m -= 7;
    } else {
        for (int i = 255; i < 264; i ++)
            xs |= data[i] * (1 << (i - 255));
        m -= 9;
    }
    int axs = 0;
    for (int i = 1; i <= m; i ++)
        axs ^= data[i - 1] * i;
    for (int i = 1; i <= m; i ++) {
        int b = 1 - data[i - 1];
        if ((axs ^ (b * i)) == xs) {
            v.push_back(b);
            axs = xs;
        } else
            v.push_back(1 - b);
    }
    return v;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 796 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1040 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -