#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
extern pair<vector<int>, long long> transaction(long long M);
void buy_souvenirs(int N, long long P0) {
if (N == 2) {
auto [gotten, change] = transaction(P0 - 1);
return;
}
if(N == 3){
auto [gotten1, change1] = transaction(P0 - 1);
ll use;
// got cheapest
if(gotten1.size() == 1){
use = (P0 - 1) - change1;
auto [gotten2, change2] = transaction(use);
auto [gotten3, change3] = transaction(use);
}
// bough 2 items
else{
use = ((P0 - 1) - change1) / 2;
auto [gotten2, change2] = transaction(use);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |