#include "transfer.h"
#include<vector>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int n = (int)source.size();
int XOR = 0, cnt = 0;
for(int i = 0;i < n;++i){
if(source[i]){
XOR ^= (i + 1);
cnt++;
}
}
vector<int>res;
if(n > 100){
for(int i = 0;i < 8;++i){
if(XOR & (1 << i)){
res.push_back(1);
}
else{
res.push_back(0);
}
}
}
else{
for(int i = 0;i < 6;++i){
if(XOR & (1 << i)){
res.push_back(1);
}
else{
res.push_back(0);
}
}
}
res.push_back(cnt & 1);
return res;
}
vector<int> retrieve(vector<int> data) {
int n = (int)data.size();
vector<int>res;
int XOR[2] = {}, par = 0, cnt = 0;
if(n > 100){
for(int i = 0;i < 255;++i){
if(data[i]){
XOR[0] ^= (i + 1);
cnt++;
}
res.push_back(data[i]);
}
for(int i = 0;i < 8;++i){
if(data[255 + i]){
XOR[1] += (1 << i);
}
}
par = data[263];
if(XOR[0] != XOR[1] && cnt % 2 != par){
int pos = XOR[0] ^ XOR[1];
res[pos - 1] ^= 1;
}
}
else{
for(int i = 0;i < 63;++i){
if(data[i]){
XOR[0] ^= (i + 1);
cnt++;
}
res.push_back(data[i]);
}
for(int i = 0;i < 6;++i){
if(data[63 + i]){
XOR[1] += (1 << i);
}
}
par = data[69];
if(XOR[0] != XOR[1] && cnt % 2 != par){
int pos = XOR[0] ^ XOR[1];
res[pos - 1] ^= 1;
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
792 KB |
Output is correct |
2 |
Correct |
2 ms |
792 KB |
Output is correct |
3 |
Correct |
1 ms |
888 KB |
Output is correct |
4 |
Correct |
2 ms |
792 KB |
Output is correct |
5 |
Correct |
2 ms |
792 KB |
Output is correct |
6 |
Correct |
1 ms |
804 KB |
Output is correct |
7 |
Correct |
1 ms |
792 KB |
Output is correct |
8 |
Correct |
2 ms |
796 KB |
Output is correct |
9 |
Correct |
2 ms |
792 KB |
Output is correct |
10 |
Correct |
2 ms |
800 KB |
Output is correct |
11 |
Correct |
2 ms |
792 KB |
Output is correct |
12 |
Correct |
2 ms |
792 KB |
Output is correct |
13 |
Correct |
3 ms |
792 KB |
Output is correct |
14 |
Correct |
2 ms |
800 KB |
Output is correct |
15 |
Correct |
2 ms |
796 KB |
Output is correct |
16 |
Correct |
3 ms |
880 KB |
Output is correct |
17 |
Correct |
2 ms |
800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
2508 KB |
Output is correct |
2 |
Correct |
49 ms |
2508 KB |
Output is correct |
3 |
Correct |
46 ms |
2504 KB |
Output is correct |
4 |
Correct |
47 ms |
2504 KB |
Output is correct |
5 |
Correct |
48 ms |
2508 KB |
Output is correct |
6 |
Correct |
47 ms |
2504 KB |
Output is correct |
7 |
Correct |
49 ms |
2520 KB |
Output is correct |
8 |
Correct |
46 ms |
2508 KB |
Output is correct |
9 |
Correct |
47 ms |
2516 KB |
Output is correct |
10 |
Correct |
45 ms |
2504 KB |
Output is correct |
11 |
Correct |
45 ms |
2512 KB |
Output is correct |
12 |
Correct |
45 ms |
2508 KB |
Output is correct |
13 |
Correct |
45 ms |
2512 KB |
Output is correct |
14 |
Correct |
46 ms |
2516 KB |
Output is correct |
15 |
Correct |
65 ms |
2508 KB |
Output is correct |
16 |
Correct |
47 ms |
2516 KB |
Output is correct |
17 |
Correct |
48 ms |
2504 KB |
Output is correct |
18 |
Correct |
46 ms |
2516 KB |
Output is correct |
19 |
Correct |
45 ms |
2508 KB |
Output is correct |