| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1364052 | eli | Data Transfer (IOI19_transfer) | C++20 | 3 ms | 1724 KiB |
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
#define out(x) #x<<" = "<<x<<" "
std::vector<int> get_attachment(std::vector<int> source) {
vector<int> ans;
//ans = source;
int xorr = 0;
for(int i = 0; i < 8; i++){
xorr = 0;
//cout<<out(i)<<endl;
for(int j = 1; j <= source.size(); j++){
if((j & (1<<i)) != 0){
//cout<<out(j);
xorr = xorr ^ source[j - 1];
}
}
//cout<<endl;
ans.push_back(xorr);
}
xorr = 0;
for(int i = 0; i < ans.size(); i++){
xorr = xorr ^ ans[i];
}
for(int i = 0; i < source.size(); i++) xorr = xorr ^ source[i];
ans.push_back(xorr);
return ans;
}
vector<int> retrieve(vector<int> data) {
vector<int> ans;
ans.clear();
//cout<<data.size()<<endl;
int xorr = 0;
for(int i = 0; i < data.size() - 1; i++){
xorr = xorr ^ data[i];
}
if(xorr == data[data.size() - 1]){
for(int i = 0; i < data.size() - 9; i++) ans.push_back(data[i]);
//cout<<ans.size()<<" "<<data.size()<<endl;
return ans;
}
int curr = 0;
for(int i = 0; i < 8; i++){
xorr = 0;
for(int j = 1; j <= data.size() - 9; j++){
if((j & (1 <<i)) != 0) xorr = xorr ^ data[j - 1];
}
if(xorr != data[data.size() - 9 + i]){
curr += (1<<i);
//cout<<i<<" ";
}
}
curr--;
if(curr == -1){
for(int i = 0; i < data.size() - 9; i++) ans.push_back(data[i]);
//cout<<ans.size()<<" "<<data.size()<<endl;
return ans;
}
data[curr] = (data[curr] + 1) % 2;
bool ok = true;
for(int i = 0; i < 8; i++){
xorr = 0;
for(int j = 1; j <= data.size() - 9; j++){
if((j & (1 <<i)) != 0) xorr = xorr ^ data[j - 1];
}
if(xorr != data[data.size() - 9 + i]){
ok = false;
}
}
if(!ok) data[curr] = (data[curr] + 1) % 2;
for(int i = 0; i < data.size() - 9; i++){
ans.push_back(data[i]);
}
//cout<<ans.size()<<" "<<curr<<endl;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
