#include "transfer.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>get_attachment(vector<int>T) {
vector<int>K;
if(T.size()==63) {
rep(i, 6) {
int akt=0;
rep(a, 63) if((a+1)&(1<<i)) akt^=T[a];
K.pb(akt);
}
int akt=0;
rep(a, 63) akt^=T[a];
K.pb(akt);
return K;
}
rep(i, 8) {
int akt=0;
rep(a, 255) if((a+1)&(1<<i)) akt^=T[a];
K.pb(akt);
}
int akt=0;
rep(a, 255) akt^=T[a];
K.pb(akt);
return K;
}
vector<int>retrieve(vector<int>T) {
if(T.size()<100) {
vector<int>P;
rep(i, 6) {
int akt=0;
rep(a, 63) if((a+1)&(1<<i)) akt^=T[a];
P.pb(akt);
}
int akt=0;
rep(a, 63) akt^=T[a];
P.pb(akt);
int ile=0;
rep(i, 7) if(P[i]!=T[63+i]) ++ile;
if(ile>1) {
int jaki=-1;
rep(i, 6) if(P[i]!=T[63+i]) jaki+=1<<i;
T[jaki]^=1;
}
rep(i, 7) T.pop_back();
return T;
}
vector<int>P;
rep(i, 8) {
int akt=0;
rep(a, 255) if((a+1)&(1<<i)) akt^=T[a];
P.pb(akt);
}
int akt=0;
rep(a, 255) akt^=T[a];
P.pb(akt);
int ile=0;
rep(i, 9) if(P[i]!=T[255+i]) ++ile;
if(ile>1) {
int jaki=-1;
rep(i, 8) if(P[i]!=T[255+i]) jaki+=1<<i;
T[jaki]^=1;
}
rep(i, 9) T.pop_back();
return T;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
776 KB |
Output is correct |
2 |
Correct |
5 ms |
648 KB |
Output is correct |
3 |
Correct |
6 ms |
644 KB |
Output is correct |
4 |
Correct |
5 ms |
652 KB |
Output is correct |
5 |
Correct |
5 ms |
644 KB |
Output is correct |
6 |
Correct |
5 ms |
652 KB |
Output is correct |
7 |
Correct |
6 ms |
644 KB |
Output is correct |
8 |
Correct |
5 ms |
732 KB |
Output is correct |
9 |
Correct |
6 ms |
728 KB |
Output is correct |
10 |
Correct |
6 ms |
652 KB |
Output is correct |
11 |
Correct |
5 ms |
652 KB |
Output is correct |
12 |
Correct |
5 ms |
736 KB |
Output is correct |
13 |
Correct |
5 ms |
652 KB |
Output is correct |
14 |
Correct |
5 ms |
620 KB |
Output is correct |
15 |
Correct |
5 ms |
644 KB |
Output is correct |
16 |
Correct |
5 ms |
648 KB |
Output is correct |
17 |
Correct |
5 ms |
644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
168 ms |
2516 KB |
Output is correct |
2 |
Correct |
165 ms |
2488 KB |
Output is correct |
3 |
Correct |
167 ms |
2456 KB |
Output is correct |
4 |
Correct |
171 ms |
2504 KB |
Output is correct |
5 |
Correct |
167 ms |
2500 KB |
Output is correct |
6 |
Correct |
170 ms |
2488 KB |
Output is correct |
7 |
Correct |
169 ms |
2488 KB |
Output is correct |
8 |
Correct |
172 ms |
2500 KB |
Output is correct |
9 |
Correct |
168 ms |
2456 KB |
Output is correct |
10 |
Correct |
166 ms |
2500 KB |
Output is correct |
11 |
Correct |
165 ms |
2500 KB |
Output is correct |
12 |
Correct |
170 ms |
2504 KB |
Output is correct |
13 |
Correct |
168 ms |
2488 KB |
Output is correct |
14 |
Correct |
172 ms |
2500 KB |
Output is correct |
15 |
Correct |
166 ms |
2500 KB |
Output is correct |
16 |
Correct |
170 ms |
2488 KB |
Output is correct |
17 |
Correct |
170 ms |
2488 KB |
Output is correct |
18 |
Correct |
176 ms |
2504 KB |
Output is correct |
19 |
Correct |
165 ms |
2512 KB |
Output is correct |