# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143837 | SpeedOfMagic | Data Transfer (IOI19_transfer) | C++17 | 161 ms | 2652 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int x = 0;
vector<int> res;
for (int i = 0; i < source.size(); i++)
x ^= (i + 1) * source[i];
int lim = (source.size() == 63) ? 6 : 8;
int X = 0;
for (int i = 0; i < lim; i++) {
int d = (x & (1 << i)) != 0;
res.push_back(d);
X ^= d;
}
res.push_back(X);
return res;
}
vector<int> retrieve(vector<int> data) {
//for (int i = 0; i < data.size(); i++) cout << data[i]; cout << endl;
int st;
int len;
if (data.size() == 70) {
st = 63;
len = 6;
} else {
st = 255;
len = 8;
}
int x = 0;
int X = 0;
for (int i = st; i < st + len; i++) {
x += (1 << (i - st)) * data[i];
X ^= data[i];
}
int rx = 0;
for (int i = 0; i < st; i++)
rx ^= (i + 1) * data[i];
vector<int> ans;
if (x != rx) {
if (X != data.back()) { //problem with xor
for (int i = 0; i < st; i++)
ans.push_back(data[i]);
} else { //problem with the main part
for (int i = 0; i < st; i++) {
if ((rx ^ (i + 1)) == x)
ans.push_back(1 - data[i]);
else
ans.push_back(data[i]);
}
}
} else //problem with the last bit, or there's no problem
for (int i = 0; i < st; i++)
ans.push_back(data[i]);
//for (int i : ans) cout << i; cout << endl;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |