#include "transfer.h"
#include "iostream"
using namespace std;
vector<int> get_attachment(vector<int> source) {
int n = source.size();
int xs = 0;
for (int i = 1; i <= n; i ++)
xs ^= source[i - 1] * i;
vector<int> v;
if (63 == n)
for (int i = 0; i < 7; i ++) {
int b = 0 < (xs & (1 << i));
v.push_back(b);
}
else
for (int i = 0; i < 9; i ++) {
int b = 0 < (xs & (1 << i));
v.push_back(b);
}
return v;
}
vector<int> retrieve(vector<int> data) {
vector<int> v;
int m = data.size();
int xs = 0;
if (70 == m) {
for (int i = 63; i < 70; i ++)
xs |= data[i] * (1 << (i - 63));
m -= 7;
} else {
for (int i = 255; i < 264; i ++)
xs |= data[i] * (1 << (i - 255));
m -= 9;
}
int axs = 0;
for (int i = 1; i <= m; i ++)
axs ^= data[i - 1] * i;
//cout << xs << ' ' << axs << '\n';
for (int i = 1; i <= m; i ++) {
if ((axs ^ i) == xs) {
v.push_back(1 - data[i - 1]);
axs = xs;
} else
v.push_back(data[i - 1]);
}
return v;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
788 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
2504 KB |
WA in grader: wrong source retrieval |
2 |
Halted |
0 ms |
0 KB |
- |