# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1252841 | an22inkle | 축제 (IOI25_festival) | C++20 | 0 ms | 0 KiB |
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<int> max_coupons(int A, std::vector<ll> P, std::vector<ll> T) {
int n = P.size();
int mode = 0; // scan for increments
vector<int> ans;
vector<bool> ok(n);
while (mode == 0) {
mode = 1;
int tgt = -1;
for (int i = 0; i < n; i++) {
if (ok[i] == 0) { // && A >= (T[i]*P[i])/(T[i] - 1)))
mode = 0;
if (tgt == -1) {
tgt = i;
} else if (1LL*T[i]*(A - P[i]) > 1LL*T[tgt]*(A - P[tgt])) {
tgt = i;
}
}
}
A = 1LL*T[tgt]*(A - P[tgt]);
ok[tgt] = 1;
ans.push_back(tgt);
}
return ans;
}