이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int i,n,j,cnt[10],ch=0,k;
n=source.size();
memset(cnt,0,sizeof cnt);
if(n==63) k=6;
else k=8;
for(i=0;i<n;i++){
if(source[i]!=1) continue;
for(j=0;j<k;j++){
if((i&(1<<j))!=0) cnt[j]=1-cnt[j];
}
ch=1-ch;
}
vector<int> ans;
ans.clear();
for(i=0;i<k;i++) ans.push_back(cnt[i]);
ans.push_back(ch);
return ans;
}
vector<int> retrieve(vector<int> data) {
int n=data.size(),k,cnt[10],ch=0,m=0,i,j;
if(n<100) n=63,k=6;
else n=255,k=8;
memset(cnt,0,sizeof cnt);
for(i=0;i<n;i++){
if(data[i]!=1) continue;
for(j=0;j<k;j++){
if((i&(1<<j))!=0) cnt[j]=1-cnt[j];
}
ch=1-ch;
}
vector<int> ans;
ans.clear();
if(ch==data[n+k]){
for(i=0;i<n;i++){
ans.push_back(data[i]);
}
return ans;
}else{
for(j=0;j<k;j++){
if(data[n+j]!=cnt[j]){
m+=(1<<j);
}
}
for(i=0;i<n;i++){
if(i!=m) ans.push_back(data[i]);
else ans.push_back(1-data[i]);
}
return ans;
}
}
/*
5
0 011001010110110110100111110011010111111111111000101011100101001
7 011001010110110110100111110011010111111111111000101011100101001
62 011001010110110110100111110011010111111111111000101011100101001
63 011001010110110110100111110011010111111111111000101011100101001
-1 011001010110110110100111110011010111111111111000101011100101001
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |