답안 #954905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954905 2024-03-28T19:21:05 Z Lemser Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "Annalib.h"
#define endl '\n'
#define mp make_pair
#define f first
#define s second
#define pb push_back
#define fore(i,l,r) for(int i=l;i<r;i++)
#define fo(i,n) fore(i,0,n)
#define forex(i,r,l) for(int i=r;i>=l;i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define ll long long
using namespace std;
using vi = vector<int>;using ii = pair<int,int>;
ll A[160];
void Set(int idx, int bit ){
	A[idx] = bit;
}
string desc(long long X)
{
  string resp;
  while (X)
  {
    ll mod = X % 2ll;
 
    if (mod == 1)
    {
        resp += "1";
    }else
    {
        resp += "0";
    }
    
    X /= 2;
  }
 
  while ((int)resp.size() < 60)
  {
    resp += "0";
  }
  
 
  reverse(resp.begin(), resp.end());
  resp += resp;
 
  return resp;
  
}
 
void Anna( int N, long long X, int K, int P[] )
{
  string num = desc(X);
  for( int i = 0; i < 120; i++ )
  {
    int bit = num[i] - '0';
    Set(i, bit);
  }
 
  int wrongPos = P[0];
  if (wrongPos < 120)
  {
   wrongPos = 59 - wrongPos;
    int r = num[wrongPos] - '0';
 
    Set(120, r);
  }else
  {
    Set(120, 1);
  }
  
 
  for (int i = 121; i < N; i++)
  {
    Set(i, 1);
  }
 
 
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
 
long long comp(string s)
{
    reverse(s.begin(), s.end());
 
    long long resp = 0;
 
    long long p2 = 1;
 
    for (int i = 0; i < (int)s.size(); i++)
    {
        if (s[i] == '1')
        {
            resp += p2;
        }
 
        p2 *= 2;
 
    }
  
  return resp;
  
}
 
long long Bruno( int N, int A[] )
{
  
  string resp;
 
  for (int i = 0; i < 60; i++)
  {
    if (A[i] == A[i + 60])
    {
      resp += A[i] +'0';
    }else
    {
      resp += A[120] + '0';
    }
    
  }
 
  long long X = comp(resp);
  
 
  return X;
}

Compilation message

/usr/bin/ld: /tmp/ccWnwpDA.o: in function `Set(int, int)':
grader_anna.c:(.text+0x60): multiple definition of `Set(int, int)'; /tmp/ccmQru4y.o:Anna.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status