제출 #468094

#제출 시각아이디문제언어결과실행 시간메모리
468094HabitusCoins (IOI17_coins)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dec(x, y) fixed << setprecision((y)) << (x)
#define xx first
#define yy second
#define srt(v) sort((v).begin(), (v).end())
#define srtr(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define popb pop_back
#define sz(a) (int)(a).size()
#define len(a) (int)(a).length()
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int* coin_flips(int* b, int c) {
    int vr=0;
    for(int i=0; i<64; ++i) {
        vr^=b[i];
    }
    vr^=c;
    int d[1];
    d[0]=vr;
    return d;
}
int find_coin(int* b) {
    int vr=0;
    for(int i=0; i<64; ++i) {
        vr^=b[i];
    }
    return vr;
}

컴파일 시 표준 에러 (stderr) 메시지

coins.cpp: In function 'int* coin_flips(int*, int)':
coins.cpp:28:12: warning: address of local variable 'd' returned [-Wreturn-local-addr]
   28 |     return d;
      |            ^
coins.cpp:26:9: note: declared here
   26 |     int d[1];
      |         ^
/usr/bin/ld: /tmp/cczGrMoS.o: in function `main':
grader.cpp:(.text.startup+0x3a5): undefined reference to `coin_flips(std::vector<int, std::allocator<int> >, int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x997): undefined reference to `find_coin(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status