| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1316534 | aaaaaaaa | Data Transfer (IOI19_transfer) | C++20 | 4 ms | 1712 KiB |
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
int K = 10;
std::vector<int> get_attachment(std::vector<int> source) {
vector<int> ans(K, 0);
int x = 0;
for(int i = 0; i < (int) source.size(); ++i){
x |= source[i] * i;
}
int cnt = 0;
for(int i = K - 2; i >= 0; --i){
if(x & (1 << i)){
ans[i] = 1;
cnt += 1;
}
}
ans[K - 1] = cnt & 1;
return ans;
}
std::vector<int> retrieve(std::vector<int> data) {
int n = data.size(), cnt = 0, x = 0;
for(int j = n - 2, ptr = K - 2; ptr >= 0; --j, --ptr){
if(data[j]) {
cnt += 1;
x |= (1 << ptr);
}
}
vector<int> ans;
for(int j = 0; j < n - K; ++j){
ans.push_back(data[j]);
}
if((cnt & 1) == data.back()){
int nx = 0;
for(int j = 0; j < n - K; ++j){
if(data[j]) nx |= data[j] * j;
}
for(int j = 0; j < n - K; ++j){
if(nx ^ ((!data[j]) * j) == x){
ans[j] ^= 1;
break;
}
}
}
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
