| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1322255 | Trisanu_Das | 축제 (IOI25_festival) | C++20 | 0 ms | 0 KiB |
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
vector<int> max_coupons(int A, vector<int> P, vector<int> T){
ll a = A;
vector<ll> p(all(P)), t(all(T));
ll n = p.size();
vector<ll> o(n);
iota(all(o), 0);
sort(all(o), [&](ll i, ll j) {
ll x = p[i], y = p[j], t1 = t[i], t2 = t[j];
return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
});
vector<int> r;
for(ll k = 0; k < n; k++){
ll i = o[k];
if(a - p[i] < 0) break;
a -= p[i];
a *= t[i];
r.pb((int)i);
}
return r;
}
