#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL
vector<int> get_attachment(vector<int> a)
{
vector<int> r;
int xorr = 0;
int ind = 1;
int cnt = 0;
for(int x : a)
{
if(x) xorr^=ind, cnt^=1;
ind++;
}
int w = 6;
if(len(a)==255) w = 8;
for(int i = 0;i<w;i++)
{
int bit = (xorr>>i)&1;
r.pb(bit);
}
r.pb(cnt);
return r;
}
vector<int> retrieve(vector<int> a)
{
int l = 63;
int poc = 63;
int w = 6;
if(len(a)>80) l = 255, poc = 255, w = 8;
int xor1, xor2;
xor1 = xor2 = 0;
for(int i = 0;i<l;i++) if(a[i]) xor1^=(i+1);
int cnt = 0;
for(int i = poc;i-poc<w;i++)
{
int bit = a[i];
if(bit) cnt^=1;
xor2+=bit*(1<<(i-poc));
}
vector<int> r;
if(xor1==xor2)
{
for(int i = 0;i<l;i++) r.pb(a[i]);
return r;
}
if(cnt!=a[len(a)-1])
{
for(int i = 0;i<l;i++) r.pb(a[i]);
return r;
}
int p = xor1^xor2;
for(int i = 0;i<l;i++)
{
if(p==i+1) r.pb(a[i]^1);
else r.pb(a[i]);
}
return r;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1088 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
2592 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |