답안 #866709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
866709 2023-10-26T19:18:22 Z SorahISA Data Transfer (IOI19_transfer) C++17
100 / 100
127 ms 2760 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> get_attachment(vector<int> source) {
    int N = source.size();
    vector<int> ret(__lg(N-1) + 2, 0);
    for (int i = 0; i <= __lg(N-1); ++i) {
        for (int j = 1; j <= N; ++j) {
            ret[i] ^= (j >> i & 1) * source[j-1];
        }
        ret.back() ^= ret[i];
    }
    return ret;
}

vector<int> retrieve(vector<int> data) {
    int N = (data.size() < 255 ? 63 : 255);
    int K = data.size() - N;
    vector<int> ret(begin(data) + N, end(data));
    for (int i = 0; i < K-1; ++i) ret.back() ^= ret[i];
    if (ret.back() == 1) return vector<int>(begin(data), begin(data) + N);
    int sus = 0;
    for (int i = 0; i < K-1; ++i) {
        for (int j = 1; j <= N; ++j) {
            ret[i] ^= (j >> i & 1) * data[j-1];
        }
        if (ret[i]) sus |= (1 << i);
    }
    if (sus > 0) data[sus-1] ^= 1;
    return vector<int>(begin(data), begin(data) + N);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 796 KB Output is correct
2 Correct 3 ms 1044 KB Output is correct
3 Correct 2 ms 800 KB Output is correct
4 Correct 3 ms 792 KB Output is correct
5 Correct 2 ms 796 KB Output is correct
6 Correct 2 ms 792 KB Output is correct
7 Correct 2 ms 800 KB Output is correct
8 Correct 2 ms 800 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 2 ms 784 KB Output is correct
11 Correct 3 ms 792 KB Output is correct
12 Correct 2 ms 796 KB Output is correct
13 Correct 4 ms 792 KB Output is correct
14 Correct 2 ms 804 KB Output is correct
15 Correct 2 ms 800 KB Output is correct
16 Correct 2 ms 800 KB Output is correct
17 Correct 2 ms 800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 118 ms 2520 KB Output is correct
2 Correct 117 ms 2640 KB Output is correct
3 Correct 118 ms 2512 KB Output is correct
4 Correct 116 ms 2500 KB Output is correct
5 Correct 124 ms 2512 KB Output is correct
6 Correct 120 ms 2516 KB Output is correct
7 Correct 119 ms 2664 KB Output is correct
8 Correct 117 ms 2520 KB Output is correct
9 Correct 117 ms 2504 KB Output is correct
10 Correct 117 ms 2508 KB Output is correct
11 Correct 121 ms 2516 KB Output is correct
12 Correct 119 ms 2516 KB Output is correct
13 Correct 117 ms 2516 KB Output is correct
14 Correct 118 ms 2508 KB Output is correct
15 Correct 122 ms 2508 KB Output is correct
16 Correct 119 ms 2516 KB Output is correct
17 Correct 127 ms 2760 KB Output is correct
18 Correct 119 ms 2516 KB Output is correct
19 Correct 116 ms 2516 KB Output is correct