답안 #1006178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1006178 2024-06-23T14:01:36 Z basa Data Transfer (IOI19_transfer) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "transfer.h"

using namespace std;

#define int long long

vector<int>get_attachment(vector<int>a)
{
  int eo = 0;
  int one = 0;
  int n = a.size();

  vector<int>ret;
  for(int i = 0; i < n; i++){
    eo ^= a[i];
    if(a[i] == 1) one ^= i + 1;
    ret.push_back(a[i]);
  }

  for(int i = 7; i >= 0; i--){
    int bit = 1 << i;
    if(one >= bit){
      one -= bit;
      ret.push_back(1);
    }
    else ret.push_back(0);
  }
  ret.push_back(eo);

  return ret;
}

vector<int> retrieve(vector<int> data)
{
  int eo = 0;
  int back = 0;
  int n = data.size();

  for(int i = n - 9; i < n - 1; i++){
    if(data[i]) back += 1 << (7 - (i - 255));
  }

  vector<int>ret;
  for(int i = 0; i < n - 9; i++){
    ret.push_back(data[i]);
    eo ^= data[i];
  }

  if(eo == data.back()) return ret;

  int p = 0;
  for(int i = 0; i < n - 9; i++){
    if(data[i]) p ^= i + 1;
  }

  if((p ^ back) > 0) ret[(p ^ back) - 1] = !ret[(p ^ back) - 1];
  return ret;
}

Compilation message

/usr/bin/ld: /tmp/ccZ7pLKh.o: in function `pass1()':
grader.cpp:(.text+0x928): undefined reference to `get_attachment(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: /tmp/ccZ7pLKh.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