답안 #307868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
307868 2020-09-29T12:42:09 Z joylintp Data Transfer (IOI19_transfer) C++17
100 / 100
385 ms 2756 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 < __lg(N + 1); 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[8] = {};
    for (int i = 0; i < __lg(N + 1); 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 < __lg(N + 1); 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1148 KB Output is correct
2 Correct 8 ms 980 KB Output is correct
3 Correct 8 ms 1280 KB Output is correct
4 Correct 8 ms 908 KB Output is correct
5 Correct 8 ms 1036 KB Output is correct
6 Correct 9 ms 1136 KB Output is correct
7 Correct 8 ms 908 KB Output is correct
8 Correct 8 ms 1156 KB Output is correct
9 Correct 9 ms 1036 KB Output is correct
10 Correct 8 ms 1036 KB Output is correct
11 Correct 8 ms 1152 KB Output is correct
12 Correct 8 ms 908 KB Output is correct
13 Correct 8 ms 1036 KB Output is correct
14 Correct 8 ms 908 KB Output is correct
15 Correct 8 ms 1152 KB Output is correct
16 Correct 8 ms 908 KB Output is correct
17 Correct 8 ms 1148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 2680 KB Output is correct
2 Correct 380 ms 2628 KB Output is correct
3 Correct 377 ms 2664 KB Output is correct
4 Correct 380 ms 2628 KB Output is correct
5 Correct 375 ms 2500 KB Output is correct
6 Correct 373 ms 2628 KB Output is correct
7 Correct 375 ms 2680 KB Output is correct
8 Correct 374 ms 2676 KB Output is correct
9 Correct 376 ms 2680 KB Output is correct
10 Correct 377 ms 2756 KB Output is correct
11 Correct 371 ms 2628 KB Output is correct
12 Correct 377 ms 2500 KB Output is correct
13 Correct 375 ms 2668 KB Output is correct
14 Correct 379 ms 2676 KB Output is correct
15 Correct 385 ms 2668 KB Output is correct
16 Correct 379 ms 2628 KB Output is correct
17 Correct 382 ms 2628 KB Output is correct
18 Correct 378 ms 2628 KB Output is correct
19 Correct 376 ms 2672 KB Output is correct