# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1282059 | nataliaa | Festival (IOI25_festival) | C++20 | 0 ms | 0 KiB |
#include "festival.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) {
int n = P.size();
pair<int,int> p1[n], p[n];
for(int i = 0; i <n; i++) {
p[i].first = P[i];
p[i].second = i;
p1[i].first = i;
p1[i].second = T[i];
}
sort(p, p+n);
vector<int> v;
map<int, bool> m;
for(int i = 0; i < n ; i++) {
int mn = 1e9, ind =-1;
for(int j = 0; j<n; j++) {
if(m[p[j].second]==false) continue
if(p[j].first<=A) {
int k = (A-p[j].first)*p1[p[j].second].second;
if(k<mn) {
mn = k;
ind = j;
}
}
}
m[ind] = 1;
v.push_back(ind);
}
return v;
}