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 "transfer.h"
#include <bits/stdc++.h>
#define loop(i, a, b) for(int i=a;i<b;i++)
using namespace std;
vector<int> get_attachment(vector<int> s) {
int n=s.size();
vector<int> ans(n+9, 0);
loop(i, 0, n){
int t=i;
loop(j, 0, 8) ans[n+j]^=ans[i]&& (t&1), t>>=1;
}
loop(i, n, n+8) ans[n+9]^=ans[i];
return ans;
}
vector<int> retrieve(vector<int> d) {
int n=d.size()-9, te=0, wr=0, fl=1;
vector<int> ans, check(8, 0);loop(i, 0, n) ans[i]=d[i];
loop(i, n, n+8) te^=ans[i];
if(te!=ans[n+9]) return ans;
loop(i, 0, n){
int t=i;
loop(j, 0, 8) check[j]^=d[i]&& (t&1), t<<=1;
}
loop(i, 0, 8) if(check[i]!=ans[n+i]) wr+=(1<<i), fl=0;
if(fl) return ans;
ans[wr]=(!ans[wr]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |