제출 #1285239

#제출 시각아이디문제언어결과실행 시간메모리
1285239ecen30선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include <vector>
#include <iostream>
#include <utility>
//This is ChatGPT code. I am using this website to test different AI's and their abilities to solve IOI problems. Please understand. I do not mean to cheat. Just trying to get a good grade on my science project.
using namespace std;

// This is the interface for querying the seller.
pair<vector<int>, long long> transaction(long long M) {
    // This function would interact with the system.
    // In actual code, we would not write this. It's provided for simulation purposes.
    // Returns a pair: the list of souvenir types bought and remaining coins.
    return {{}, 0};  // placeholder
}

void buy_souvenirs(int N, long long P0) {
    // The prices we need to deduce
    vector<long long> P(N, 0);
    P[0] = P0;  // we know P[0]

    // Deduce the prices for other souvenir types
    vector<long long> possible_prices(N);
    for (int i = 0; i < N; ++i) {
        possible_prices[i] = P0 - i;
    }

    // Perform transactions and deduce the prices
    // Start with the largest possible value of M and narrow down
    for (int i = 1; i < N; ++i) {
        long long M = P[i-1] - 1;
        auto result = transaction(M);
        vector<int> souvenirs = result.first;
        long long remaining = result.second;

        // Analyze the response and narrow down the possible prices.
        for (int j : souvenirs) {
            P[j] = possible_prices[j];
        }
    }

    // Perform the final transactions to buy the exact number of souvenirs
    for (int i = 1; i < N; ++i) {
        long long M = P[i];
        auto result = transaction(M);
        vector<int> souvenirs = result.first;
        long long remaining = result.second;
    }
}

int main() {
    int N = 3;
    long long P0 = 4;

    buy_souvenirs(N, P0);

    return 0;
}

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

/usr/bin/ld: /tmp/ccxcWVge.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccK51VmF.o:souvenirs.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccxcWVge.o: in function `transaction(long long)':
stub.cpp:(.text+0x200): multiple definition of `transaction(long long)'; /tmp/ccK51VmF.o:souvenirs.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status