| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1337800 | playeragp | Souvenirs (IOI25_souvenirs) | C++20 | 12 ms | 344 KiB |
#include <vector>
#include <numeric>
#include <algorithm>
std::pair<std::vector<int>, long long> transaction(long long M);
void buy_souvenirs(int N, long long P0) {
std::vector<long long> P(N);
P[0] = P0;
for (int i = 1; i < N; ++i) {
long long low = 1, high = P[i - 1] - 1;
long long current_P = 1;
while (low <= high) {
long long mid = low + (high - low) / 2;
auto res = transaction(mid);
bool found_smaller = false;
for (int type : res.first) {
if (type < i) {
found_smaller = true;
break;
}
}
if (found_smaller) {
high = mid - 1;
} else {
current_P = mid / (long long)res.first.size();
low = mid + 1;
}
}
long long L = 1, R = P[i-1] - 1;
while(L <= R) {
long long mid = L + (R - L) / 2;
auto res = transaction(mid);
int best_type = res.first[0];
if (best_type < i) {
R = mid - 1;
} else if (best_type > i) {
L = mid + 1;
} else {
P[i] = mid - res.second;
break;
}
}
}
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... | ||||
