제출 #1288730

#제출 시각아이디문제언어결과실행 시간메모리
1288730ecen30선물 (IOI25_souvenirs)C++20
0 / 100
13 ms332 KiB
//testing AI COde
#include <bits/stdc++.h>
using namespace std;

// The grader provides this function
pair<vector<int>, long long> transaction(long long M);

void buy_souvenirs(int N, long long P0) {
    vector<long long> P(N);
    P[0] = P0;

    // === Step 1: Deduce other prices ===
    // We'll use simple linear probing from P0-1 downward
    // to find points where purchased souvenirs change.
    map<vector<int>, long long> seen;
    long long low = 1, high = P0 - 1;

    // store results of distinct outcomes
    for (long long m = high; m >= 1 && (int)seen.size() < N; --m) {
        auto [souvs, ret] = transaction(m);
        if (!seen.count(souvs))
            seen[souvs] = m;
    }

    // Extract discovered souvenir patterns sorted by m
    vector<pair<long long, vector<int>>> data;
    for (auto &it : seen)
        data.push_back({it.second, it.first});

    sort(data.begin(), data.end(),
         [](auto &a, auto &b) { return a.first > b.first; });

    // We can’t know exact P[i], but we can buy exactly i souvenirs of type i
    // === Step 2: Buy required souvenirs ===
    // For simplicity, make i transactions for type i
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < i; j++) {
            long long M = max(1LL, high - i); // ensure M < P0
            auto [souvs, ret] = transaction(M);
            // We don’t actually need to check what we got; the grader will track
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...