#include <bits/stdc++.h>
using namespace std;
//This is Grok 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.
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;
// Discover P[1] to P[N-1] using binary search
for (int i = 1; i < N; ++i) {
long long low = 1;
long long high = P[i - 1] - 1;
long long price = -1;
while (low <= high) {
long long mid = low + (high - low) / 2;
auto [types, rem] = transaction(mid);
bool got_i_or_higher = false;
for (int t : types) {
if (t >= i) {
got_i_or_higher = true;
break;
}
}
if (got_i_or_higher) {
price = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
P[i] = price;
}
// Buy exactly i of type i for i=1 to N-1
for (int i = 1; i < N; ++i) {
for (int j = 0; j < i; ++j) {
transaction(P[i]);
}
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |