| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1337795 | playeragp | 선물 (IOI25_souvenirs) | C++20 | 12 ms | 400 KiB |
#include <vector>
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, 0);
std::vector<int> count(N, 0);
P[0] = P0;
for (int i = 1; i < N; ++i) {
if (P[i] != 0) continue;
long long M = P[i - 1] - 1;
auto res = transaction(M);
for (int type : res.first) count[type]++;
long long spent_on_others = 0;
bool found_i = false;
for (size_t j = 0; j < res.first.size(); ++j) {
int t = res.first[j];
if (t == i) found_i = true;
else if (found_i && P[t] != 0) spent_on_others += P[t];
}
if (found_i) {
P[i] = M - res.second - spent_on_others;
}
}
for (int i = 1; i < N; ++i) {
while (count[i] < i) {
auto res = transaction(P[i]);
for (int type : res.first) count[type]++;
}
}
}
| # | 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... | ||||
