Submission #1319413

#TimeUsernameProblemLanguageResultExecution timeMemory
1319413Trisanu_DasSouvenirs (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include "souvenirs.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second

int N, A[101];
ll P[101];

pair<vector<int, ll> > qry(ll val){
    auto res = transaction(val);
    for(auto &x : res.ff) A[x]++;
    return res;
}

int dfs(ll val, int M){
    auto [V, R] = query(val);
    assert(V[0] < M);
    ll T = val - R;
    int cur = V[0];
    while(1){
        while(V.back() >= M){
            T -= P[V.back()];
            V.pop_back();
        }
        if(cur + 1 == M) break;
        M = dfs((T - 1) / (int)V.size(), M);
    }
    P[cur] = T;
    return cur;
}

void buy_souvenirs(int N, ll P0){
    ::N = N;
    dfs(P0 - 1, N);
    for(int i = 1; i < N; i++)
        for(int j = A[i]; j < i; j++)
            query(P[i]);
}

Compilation message (stderr)

souvenirs.cpp:11:22: error: wrong number of template arguments (1, should be 2)
   11 | pair<vector<int, ll> > qry(ll val){
      |                      ^
In file included from /usr/include/c++/13/utility:69,
                 from souvenirs.h:1,
                 from souvenirs.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  187 |     struct pair
      |            ^~~~
souvenirs.cpp: In function 'int qry(long long int)':
souvenirs.cpp:14:12: error: cannot convert 'std::pair<std::vector<int>, long long int>' to 'int' in return
   14 |     return res;
      |            ^~~
      |            |
      |            std::pair<std::vector<int>, long long int>
souvenirs.cpp: In function 'int dfs(long long int, int)':
souvenirs.cpp:18:19: error: 'query' was not declared in this scope; did you mean 'qry'?
   18 |     auto [V, R] = query(val);
      |                   ^~~~~
      |                   qry
souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:39:13: error: 'query' was not declared in this scope; did you mean 'qry'?
   39 |             query(P[i]);
      |             ^~~~~
      |             qry