Submission #1335636

#TimeUsernameProblemLanguageResultExecution timeMemory
1335636dssfsuper2Souvenirs (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll> vls;
vector<ll> cn;
ll n;
void gs(ll p0){
  auto rs=transaction(p0-1);
  rs.second=p0-1-rs.second;
  ll ss=rs.second;
  ll nn=0;
  for(auto thing:rs.first){
    if(vls[thing]==-1)nn++;
    else ss-=vls[thing];
    cn[thing]++;
  }
  while(nn>=2){
    ll na=ss/nn+1;
    gs(na);
    nn=0;
    ss = rs.second;
    for(auto thing:rs.first){
      if(vls[thing]==-1)nn++;
      else ss-=vls[thing];
    }
  }
  for(auto thing:rs.first)if(vls[thing]!=-1)rs.second-=vls[thing];
  for(auto thing:rs.first){
    if(vls[thing]==-1){
      vls[thing]=rs.second;
      if(thing!=n-1 && vls[thing+1]==-1)gs(vls[thing]);
    }
  }
}
void buy_souvenirs(int N, long long P0) {
  n=N;
  vls.assign(N, -1);
  cn.assign(N, 0);
  vls[0]=P0;
  gs(P0);
  for(int i = 0;i<N;i++){
    while(cn[i]<i){
      transaction(vls[i]);
      cn[i]++;
    }
  }
  return;
}

Compilation message (stderr)

souvenirs.cpp: In function 'void gs(ll)':
souvenirs.cpp:8:11: error: 'transaction' was not declared in this scope
    8 |   auto rs=transaction(p0-1);
      |           ^~~~~~~~~~~
souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:43:7: error: 'transaction' was not declared in this scope
   43 |       transaction(vls[i]);
      |       ^~~~~~~~~~~