Submission #1254730

#TimeUsernameProblemLanguageResultExecution timeMemory
1254730MilosMilutinovicFestival (IOI25_festival)C++20
5 / 100
736 ms3576 KiB
#include "festival.h" #include <bits/stdc++.h> using namespace std; vector<int> max_coupons(int A, vector<int> p, vector<int> t) { int n = int(p.size()); vector<bool> was(n); vector<int> res; int64_t a = A; for (int i = 0; i < n; i++) { a = min(a, int64_t(1e17)); bool has = false; for (int j = 0; j < n; j++) { if (was[j] || a < p[j]) { continue; } int64_t new_a = (a - p[j]) * 1LL * t[j]; if (new_a >= a) { has = true; } } if (has) { int64_t best = int64_t(1e18); int id = -1; for (int j = 0; j < n; j++) { if (was[j] || a < p[j]) { continue; } int64_t new_a = (a - p[j]) * 1LL * t[j]; if (new_a >= a && new_a <= best) { best = new_a; id = j; } } a = best; was[id] = true; res.push_back(id); } else { int64_t best = -1; int id = -1; for (int j = 0; j < n; j++) { if (was[j] || a < p[j]) { continue; } int64_t new_a = (a - p[j]) * 1LL * t[j]; if (new_a >= best) { best = new_a; id = j; } } if (id != -1) { a = best; was[id] = true; res.push_back(id); } else { break; } } } return res; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...