답안 #829804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829804 2023-08-18T15:08:42 Z vqpahmad Data Transfer (IOI19_transfer) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mod = 1e9 + 7;
const int N = 1e6 + 15;
const ll inf = 1e18;

#include "transfer.h"

vector<int> get_attachment(vector<int> source) {
	int n = sz(source);
	vector<int> a(9);
	for (int i=1;i<=n;i++){
		for (int b=0;b<8;b++){
			if ((i>>b)&1) a[b] ^= source[i-1];
		}
	}
	for (int i=0;i<8;i++){
		a[8] ^= a[i];
	}
	return a;
}

vector<int> retrieve(vector<int> data) {
	int n = sz(data)-9;
	int ans = 0;
	bool ok = 1;
	int cur = 0;
	for (int i=n;i<n+8;i++){
		cur ^= data[i];
	}
	ok &= data.back()==cur;
	vector<int> c(8);
	for (int i=1;i<=n;i++){
		for (int b=0;b<8;b++){
			if ((i>>b)&1) c[b] ^= data[i-1];
		}
	}
	for (int i=n;i<n+8;i++){
		if (data[i] != c[i-n]) ans |= (1<<(i-n));
	}
	vector<int> fin_ans(n);
	if (ans==0 or !ok){
		for (int i=0;i<n;i++){
			fin_ans[i] = data[i];
		}
	}
	else {
		for (int i=0;i<n;i++){
			if (ans!=i-1) fin_ans[i] = data[i];
			else fin_ans[i] = data[i]^1;
		}
	}
	return fin_ans;
	// if ans==0 or !ok print the orginal else orginal^ans
}

Compilation message

/usr/bin/ld: /tmp/ccu4aVyd.o: in function `pass1()':
grader.cpp:(.text+0x928): undefined reference to `get_attachment(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: /tmp/ccu4aVyd.o: in function `pass2()':
grader.cpp:(.text+0x1711): undefined reference to `retrieve(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status