제출 #1260952

#제출 시각아이디문제언어결과실행 시간메모리
1260952alexdd축제 (IOI25_festival)C++20
5 / 100
57 ms8376 KiB
#include "festival.h" #include <bits/stdc++.h> using namespace std; long long n,init; vector<int> p,t; vector<pair<int,int>> oft[5]; std::vector<int> max_coupons(int copA, std::vector<int> P, std::vector<int> T) { long long A = copA; p = P; t = T; n = p.size(); init = A; for(int i=0;i<n;i++) { oft[t[i]].push_back({p[i], i}); } for(int c=1;c<=4;c++) { sort(oft[c].begin(), oft[c].end()); reverse(oft[c].begin(), oft[c].end()); } vector<int> sol; for(int pas=0;pas<n;pas++) { long long mxm = -1, unde = -1; for(int c=1;c<=4;c++) { if(oft[c].empty()) continue; if((A - oft[c].back().first) * c > mxm) { mxm = (A - oft[c].back().first) * c; unde = c; } } if(mxm == -1) break; A = (A - oft[unde].back().first) * unde; sol.push_back(oft[unde].back().second); oft[unde].pop_back(); } return sol; }
#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...