제출 #1251598

#제출 시각아이디문제언어결과실행 시간메모리
1251598fafnir선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

std::pair<std::vector<int>, long long> transaction(long long M) {}

/*

    p[0] > p[1] > ... > p[n-1]


    ST 1:
      *) p[0] > p[1]
      *) Make transaction p[0]-1
        -> Then buying exactly one of type 1

    ST 4:
      *) p[0] > p[1] > p[2]
      *) T1: M=p[0]-1
        --> Case 1: Buying only one souvenir
            - Bought p[1]
            - C := M-p[1]  <--> p[1] = M-C
            - T2: p[1]-1

        --> Case 2: Bought 2 souvenirs
           
            M=100,
            C=11
            (M-C)/2 - 1

            100 coins, get back 11
                -> 2 souvenirs are 89
                - p[1] > p[2]
                - p[1] + p[2] = 89
                - 89 > 2*p[2]
                - 44 > p[2]
                p[2] <= 43
*/

void buy_souvenirs(int N, long long P0) {
    if (N == 2) {
        transaction(P0-1);
    } else if (N == 3) {
        long long M = P0-1;
        auto r = transaction(M);
        long long C = r.second;
        if (r.first.size() == 1) {
            transaction(M-C-1);
        } else {
            transaction((M-C)/2-1);
        }
    }
}


#ifdef LOCAL
int32_t main() {

    return 0;
}
#endif

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

souvenirs.cpp: In function 'std::pair<std::vector<int>, long long int> transaction(long long int)':
souvenirs.cpp:4:66: warning: no return statement in function returning non-void [-Wreturn-type]
    4 | std::pair<std::vector<int>, long long> transaction(long long M) {}
      |                                                                  ^
/usr/bin/ld: /tmp/ccM4TA5X.o: in function `transaction(long long)':
stub.cpp:(.text+0x1d0): multiple definition of `transaction(long long)'; /tmp/cctfKkAZ.o:souvenirs.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status