| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1315930 | ezzzay | 축제 (IOI25_festival) | C++20 | 0 ms | 0 KiB |
//#include "festival.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) {
int N=P.size();
vector<vector<pair<int,int>>> v(5,vector<pair<int,int>>(N+5));
for(int i=0;i<N;i++){
v[T[i]].pb({P[i],i});
}
for(int i=1;i<=4;i++){
sort(v[i].begin(),v[i].end());
}
vector<int>ans;
vector<int>idx(5);
bool u=1;
while(u){
bool h=0;
for(int i=4;i>=1;i--){
if(idx[i]==v[idx[i]].size())continue;
if(v[i][idx[i]].ff<=A){
A-=v[i][idx[i]].ff;
A*=i;
ans.pb(v[i][idx[i]].ss);
idx[i]++;
h=1;
break;
}
}
u=h;
}
return ans;
}
signed main(){
}
