| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1311008 | michael12 | 선물 (IOI25_souvenirs) | C++20 | 0 ms | 0 KiB |
#include "souvenirs.h"
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define sm pair<vector<int>, long long>
using namespace std;
const int inf = 1e9;
int n;
int idx;
int e;
vector<int> dp, cnt;
int slv(ll val){
auto T = transaction(val);
vector<int> I = T.ff;
for(auto tt : I){
cnt[tt]++;
}
ll cst = val - T.ss;
while(I[0] < e){
while(e <= I.back()){
cost =- dp[I.back()];
I.pop_back();
}
int e = slv(cost / v.size());
}
dp[I[0]] = cost;
return I[0];
}
void buy_souvenirs(int N, ll P0){
n = N;
e = n;
dp.resize(n);
cnt.resize(n);
slv(P0 - 1);
for(int i = 0; i < n; i++){
while(cnt[i] < i){
transaction(dp[i]);
}
}
return;
}
