# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
443430 | chicken337 | Data Transfer (IOI19_transfer) | C++14 | 69 ms | 2540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "transfer.h"
using namespace std;
vector<int> get_attachment(vector<int> source){
vector<int> ans; int xr = 0;
for(int i = 0; i < source.size(); i ++)
xr ^= source[i] * (i+1);
int last = 0, rounds = source.size() < 64 ? 6 : 8;
for(int i = 0; i < rounds; i ++){
ans.push_back(xr & 1);
if(xr & 1) last ^= 1;
xr >>= 1;
}
ans.push_back(last);
return ans;
}
vector<int> retrieve(vector<int> data){
int last = data.back(); data.pop_back();
int actual = 0, xr = 0;
int rounds = data.size() < 71 ? 6 : 8;
for(int i = 0; i < rounds; i ++){
xr <<= 1; xr += data.back();
if(data.back()) last ^= 1;
data.pop_back();
}
if(actual != last)
return vector<int>(data.begin(), data.end());
int x = 0;
for(int i = 0; i < data.size(); i ++)
x ^= data[i] * (i+1);
int err = xr ^ x;
if(err) data[err-1] ^= 1;
return data;
}
/**
int main(){
for(int i = 0; i < 100; i ++){
bool correct = true;
vector<int> gen_seq;
int len = rand() % 255 + 1;
for(int i = 0; i < len; i ++)
gen_seq.push_back(rand()&1);
cout << "Generation OK" << endl;
vector<int> attach = get_attachment(gen_seq);
if(len < 64 && attach.size()>7) correct = 0;
if(len > 63 && attach.size()>9) correct = 0;
cout << "Attachment OK" << endl;
vector<int> nans;
for(int it : gen_seq) nans.push_back(it);
for(int it : attach) nans.push_back(it);
vector<int> res = retrieve(nans);
cout << "Retrieval OK" << endl;
if(res.size() != len) correct = 0, cout << "WRONG LENGTH" << endl;
else for(int i = 0; i < res.size(); i ++)
if(res[i] != gen_seq[i]) correct = 0, cout << "WRONG ELEMENT" << endl;
cout << (correct ? "CORRECT" : "INCORRECT") << " with length " << len << endl;
}
}**/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |