#include<bits/stdc++.h>
#include "souvenirs.h"
using namespace std;
//typedef long long ll;
//#define int ll
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int MOD=1000000007;
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define fios(); ios_base::sync_with_stdio(0);cin.tie(0);
#define fraction(x); cout.unsetf(ios::floatfield); cout.precision(x); cout.setf(ios::fixed,ios::floatfield);
#define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
/*
const int maxN=1e5 + 15;
int a[maxN];
int n;
int cnt[maxN];
pair<vector<int>,long long> transaction(long long m){
vector<int> memo;
for(int i=0;i<n;i++){
if(a[i]<=m){
cnt[i]++;
m-=a[i];
memo.pb(i);
}
}
return {memo,m};
}
*/
void buy_souvenirs(int n, long long p0){
if(n==2){
//subtask 1
transaction(p0-1);
return ;
}
if(n==3){
//idk later
pair<vector<int>,long long> tem=transaction(p0-1);
vector<int> memo=tem.ff;
if(memo.size()==1){
int cost=(p0-1)-tem.ss;
transaction(cost-1);
transaction(cost-1);
}else{
while(1){
pair<vector<int>,long long> p=transaction(1);
if(p.ff.size()==1) break;
}
}
return ;
}
//subtask 2
for(int i=0;i<n;i++){
int tem=i;
while(tem--){
transaction(n-i);
}
}
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... |