# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308237 | cheetose | Data Transfer (IOI19_transfer) | C++17 | 0 ms | 0 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>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<db> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };
#include "transfer.h"
Vi get_attachment(Vi source){
int n=source.size();
Vi res;
if(n==63){
res.resize(7);
int t=0;
fup(i,1,62,1){
if(source[i])t^=i;
}
fup(i,0,5,1){
if(t&(1<<i)){
res[i]=1;
res[6]^=1;
}
}
}else{
res.resize(9);
if(source[0]==1)res[8]=1;
fup(i,1,254,1){
if(source[i])t^=i;
}
fup(i,0,7,1){
if(t&(1<<i)){
res[i]=1;
res[8]^=1;
}
}
}
return res;
}
Vi retrieve(Vi data){
int n=data.size();
if(n>200){ // 255~262
Vi v(9);
fup(i,255,263,1)v[i-255]=data[i];
data.resize(255);
int c=0;
fup(i,0,8,1)c^=v[i];
if(c!=0){
return data;
}else{
fup(i,0,7,1){
if(v[i])c^=(1<<i);
}
data[c]^=1;
return data;
}
}else{
Vi v(7);
fup(i,63,69,1)v[i-63]=data[i];
data.resize(63);
int c=0;
fup(i,0,6,1)c^=v[i];
if(c!=0){
return data;
}else{
fup(i,0,5,1){
if(v[i])c^=(1<<i);
}
data[c]^=1;
return data;
}
}
}
/*
int main() {
}*/