Submission #711059

# Submission time Handle Problem Language Result Execution time Memory
711059 2023-03-16T07:53:15 Z Pring Data Transfer (IOI19_transfer) C++14
0 / 100
10 ms 5628 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> get_attachment(vector<int> source) {
    int n = source.size();
    vector<int> modify(n + 9);
    int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        modify[i] = source[i];
        if (modify[i]) x |= (i + 1);
    }
    for (int i = 0; i < 8; i++) {
        modify[n + i] = (bool) (x | (1 << i));
        if (modify[n + i]) y ^= 1;
    }
    modify.back() = y;
    return modify;
}

vector<int> retrieve(vector<int> data) {
    int n = data.size() - 9;
    vector<int> ans(n);
    for (int i = 0; i < n; i++) ans[i] = data[i];
    int x = 0, y = 0;
    for (int i = 0; i < 8; i++) {
        if (data[n + i]) {
            x += (1 << i);
            y ^= 1;
        }
    }
    if (y != data.back()) return ans;
    for (int i = 0; i < n; i++) {
        if (ans[i]) x |= i + 1;
    }
    if (x == 0) return ans;
    ans[x - 1] ^= 1;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 912 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 5628 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -