Submission #1259314

#TimeUsernameProblemLanguageResultExecution timeMemory
1259314nicolo_010Festival (IOI25_festival)C++20
0 / 100
1113 ms2162688 KiB
#include "festival.h"
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using v = vector<T>;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, k, n) for (int i = k; i < n; i++)

std::vector<int> max_coupons(int AA, std::vector<int> P, std::vector<int> T) {
  ll A = AA;
  v<v<int>> order;
  v<v<int>> ones;
  int N = P.size();
  rep(i, 0, N) {
    order.push_back({P[i], T[i], i});
  }
  sort(order.begin(), order.end(), [&](v<int> a, v<int> b) {
    ll v1 = -a[0]*a[1]*b[1] - b[0]*b[1];
    ll v2 = -b[0]*b[1]*a[1] - a[0]*a[1];
    return v1 > v2;
  });
  v<v<ll>> dp(N+1, v<ll>(N+1, -1));
  dp[0][0] = A;
  rep(i, 1, N+1) {
    rep(j, 1, N+1) {
      dp[i][j] = max(dp[i][j], (dp[i-1][j-1]-order[i-1][0])*order[i-1][1]);
    }
  }
  v<int> ans;
  rep(i, 0, N) {
    ans.push_back(order[i][2]);
  } 
  return ans;
}
#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...