| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1285239 | ecen30 | Souvenirs (IOI25_souvenirs) | C++20 | 0 ms | 0 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;
}
