답안 #973175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973175 2024-05-01T15:17:46 Z sleepntsheep Data Transfer (IOI19_transfer) C++17
88 / 100
58 ms 2760 KB
#include "transfer.h"

std::vector<int> get_attachment(std::vector<int> source) {
    int xorsum = 0;
    std::vector<int> v;
    for (int i = 0; i < (int)source.size(); ++i)
        if (source[i]) xorsum ^= i + 1;
    for (int i = 0; i < 8; ++i) v.push_back((xorsum>>i)&1);
    v.push_back(__builtin_parity(xorsum));
    return v;
}

std::vector<int> retrieve(std::vector<int> data) {
    int xorsum = 0;
    int n = (int)data.size() - 9;
    for (int i = 0; i < n; ++i)
        if (data[i]) xorsum ^= i + 1;

    int xordat = 0, dat_par = data.back();
    for (int i = n; i < n + 8; ++i)
        xordat ^= (data[i]<<(i-n));

    while ((int)data.size() > n) data.pop_back();
    if (__builtin_parity(xordat) != dat_par)
        return data;

    int i = xorsum ^ xordat;
    if(i)
        data[i-1] ^= 1;
    return data;
}

# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 796 KB Partially correct
2 Partially correct 1 ms 800 KB Partially correct
3 Partially correct 1 ms 876 KB Partially correct
4 Partially correct 2 ms 800 KB Partially correct
5 Partially correct 2 ms 800 KB Partially correct
6 Partially correct 2 ms 788 KB Partially correct
7 Partially correct 1 ms 800 KB Partially correct
8 Partially correct 1 ms 800 KB Partially correct
9 Partially correct 2 ms 788 KB Partially correct
10 Partially correct 2 ms 800 KB Partially correct
11 Partially correct 2 ms 792 KB Partially correct
12 Partially correct 1 ms 800 KB Partially correct
13 Partially correct 2 ms 792 KB Partially correct
14 Partially correct 2 ms 780 KB Partially correct
15 Partially correct 2 ms 880 KB Partially correct
16 Partially correct 2 ms 784 KB Partially correct
17 Partially correct 2 ms 800 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 2512 KB Output is correct
2 Correct 33 ms 2760 KB Output is correct
3 Correct 30 ms 2508 KB Output is correct
4 Correct 36 ms 2508 KB Output is correct
5 Correct 58 ms 2508 KB Output is correct
6 Correct 48 ms 2508 KB Output is correct
7 Correct 40 ms 2524 KB Output is correct
8 Correct 35 ms 2508 KB Output is correct
9 Correct 26 ms 2512 KB Output is correct
10 Correct 28 ms 2740 KB Output is correct
11 Correct 24 ms 2512 KB Output is correct
12 Correct 27 ms 2512 KB Output is correct
13 Correct 28 ms 2516 KB Output is correct
14 Correct 34 ms 2516 KB Output is correct
15 Correct 36 ms 2516 KB Output is correct
16 Correct 42 ms 2516 KB Output is correct
17 Correct 37 ms 2416 KB Output is correct
18 Correct 33 ms 2508 KB Output is correct
19 Correct 31 ms 2504 KB Output is correct