#include <bits/stdc++.h>
using namespace std;
#define repf(i,k,n) for(int i=k; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
typedef vector<int> vi;
vi get_attachment(vi source){
int n=source.size(),k=(n>200 ? 8:6);
vi v(k,0);
rep(i,n){
rep(j,k) if((i+1)&(1<<j)) v[j]^=source[i];
}
int x=0;
rep(i,n) x^=source[i];
v.push_back(x);
return v;
}
vi retrieve(vi data){
//cerr<<"\n===\n";
int n=(data.size()>200 ? 255:63),
k=(n==255?8:6);
vi v(k,0);
rep(i,n){
rep(j,k) if((i+1)&(1<<j)) v[j]^=data[i];
}
vi w(k); rep(i,k) w[i]=data[i+n];
if(v==w) cerr<<"sol1\n";
if(v==w) return vi(data.begin(),data.begin()+n);
int x=0;
rep(i,k) x^=v[i];
int cnt=0; rep(i,k) cnt+=v[i]^w[i];
//rep(i,k) cerr<<w[i]<<' '; cerr<<' '<<data.back()<<'\n';
//rep(i,k) cerr<<v[i]<<' '; cerr<<' '<<x<<'\n';
//if(cnt==1 and x!=data.back()) cerr<<"sol2\n";
if(cnt==1 and x!=data.back()) return vi(data.begin(),data.begin()+n);
x=0;
rep(i,k){
if(v[i]^w[i]) x^=(1<<i);
}
x--;
//cerr<<"flipped: " << x << '\n';
data[x]^=1;
//cerr<<"sol3\n";
return vi(data.begin(),data.begin()+n);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
792 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
2512 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |