# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1274516 | linhhnt11072010 | Souvenirs (IOI25_souvenirs) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll pp[105];
pair<vector<int>, ll> transaction(long long m);
void buy_souvenirs(int n, ll p0){
ll tt = p0;
for(int i = 1;i<n;i++){
pair<vector<int>, ll> pr = transaction(tt-1);
d++;
for(int j = 0;j<pr.first.size();j++) pp[pr.first[j]]++;
if(pr.second>0) tt = tt-2;
else tt = tt-1;
for(int j = pp[i]+1;j<=i;j++) transaction(tt);
}
}