# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213572 | _Ice_Tea_ | Data Transfer (IOI19_transfer) | C++14 | 348 ms | 2976 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "transfer.h"
#define de(x) if( x && x == MODE)
#define MODE 0
using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
int i,j,k;
int N = source.size();
int L = ( N == 63 ? 6 : 9 );
// int L = 3;
vector<int> attach;
for( i=0; i<L; i++)
{
int key = 0;
for( j=0; j<N; j++)
{
if( (j>>i)&1 )
continue;
key ^= source[j];
}
attach.push_back(key);
}
int key = 0;
for( auto it:attach)
key ^= it;
attach.push_back(key);
de(1)
{
printf(">>> ");
for( auto it:attach)
printf("%d ", it);
printf("\n");
}
return attach;
}
std::vector<int> retrieve(std::vector<int> data) {
int i,j;
int N = ( data.size() == 70 ? 63 : 255);
// int N = 7;
int L = data.size() - N - 1;
vector<int> ans;
int arr[256];
int idx = 0;
for( i=0; i<L; i++)
{
int key = 0;
for( j=0; j<N; j++)
{
if( (j>>i)&1 )
continue;
key ^= data[j];
}
if( key == data[ N+i ])
idx ^= (1<<i);
}
de(1) printf("idx = %d\n", idx);
for( i=0; i<N; i++)
ans.push_back( data[i] );
if( idx == N)
{
// return ans;
}
else
{
int key = 0;
for( i=0; i<L; i++)
key ^= data[ N+i ];
if( key != data.back())
{
// return ans;
}
else
{
ans[idx] ^= 1;
// return ans;
}
}
de(1)
{
printf("ans = ");
for( auto it: ans)
printf("%d", it);
printf("\n");
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |