#include "souvenirs.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define endl "\n"
using namespace std;
const ll infp = INT_MAX;
const ll infn = INT_MIN;
void buy_souvenirs(int N, long long P0) {
map<ll, ll> cnt_souv;
ll curr_val = P0 - 1;
for(int i=1; i<N; i++){
pair<vector<int>, ll> temp;
ll trans_count = 0;
for(int j=cnt_souv[i]; j<i; j++){
temp = transaction(curr_val);
trans_count++;
}
ll sum = 0;
for(int j=1; j<temp.first.size(); j++){
sum = sum + (temp.first[j] - i);
}
sum = sum + (curr_val - temp.second);
curr_val = (sum + temp.first.size() - 1)/(temp.first.size()) - 1;
for(int j=0; j<temp.first.size(); j++){
cnt_souv[temp.first[j]] += trans_count;
}
}
return;
}
# | 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... |