Submission #307865

# Submission time Handle Problem Language Result Execution time Memory
307865 2020-09-29T12:39:21 Z joylintp Data Transfer (IOI19_transfer) C++17
60 / 100
9 ms 2680 KB
#include <bits/stdc++.h>
#include "transfer.h"
using namespace std;

vector<int> get_attachment(vector<int> source)
{
    int N = source.size(), lst = 0;
	vector<int> ret;
    for (int i = 0; i < 6; i++)
    {
        int t = 0;
        for (int j = 0; j < N; j++)
            if ((j + 1) & (1 << i))
                t ^= source[j];
        ret.push_back(t);
        lst ^= t;
    }
    ret.push_back(lst);
    return ret;
}

vector<int> retrieve(vector<int> data)
{
	int N = (data.size() == 70 ? 63 : 255), K = data.size() - N;
	vector<int> ret;
	for (int i = 0; i < N; i++)
        ret.push_back(data[i]);

    int arr[6] = {};
    for (int i = 0; i < 6; i++)
        for (int j = 0; j < N; j++)
            if ((j + 1) & (1 << i))
                arr[i] ^= data[j];

    int inc = 0;
    for (int i = 0; i < 6; i++)
        inc += (1 << i) * (arr[i] != data[N + i]);

    int t = 0;
    for (int i = N; i < N + K - 1; i++)
        t ^= data[i];

    if (inc && t == data[N + K - 1])
        ret[inc - 1] = !ret[inc - 1];

    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1016 KB Output is correct
2 Correct 8 ms 1156 KB Output is correct
3 Correct 8 ms 1156 KB Output is correct
4 Correct 9 ms 1140 KB Output is correct
5 Correct 8 ms 912 KB Output is correct
6 Correct 8 ms 1148 KB Output is correct
7 Correct 8 ms 1152 KB Output is correct
8 Correct 8 ms 912 KB Output is correct
9 Correct 8 ms 1156 KB Output is correct
10 Correct 8 ms 1144 KB Output is correct
11 Correct 8 ms 1156 KB Output is correct
12 Correct 8 ms 912 KB Output is correct
13 Correct 8 ms 1144 KB Output is correct
14 Correct 8 ms 912 KB Output is correct
15 Correct 8 ms 1144 KB Output is correct
16 Correct 9 ms 1040 KB Output is correct
17 Correct 8 ms 1140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2680 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -