Submission #1250871

#TimeUsernameProblemLanguageResultExecution timeMemory
1250871haiphong5g0Souvenirs (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
//#include "souvenirs.h" #include <bits/stdc++.h> #define task "TEST" #define task2 "A" #define pl pair<ll, ll> #define pf push_front #define pb push_back #define pob pop_back #define pof pop_front #define mp make_pair #define fi first #define se second #define FOR(i, a, b, c) for (int i=a; i<=b; i+=c) #define FORE(i, a, b, c) for (int i=a; i>=b; i+=c) using namespace std; using ll = long long; using ull = unsigned long long; const int Mod = 998244353; const int maxn = 1e3; const ll Inf = 1e16; pair<vector<int>, ll> res; ll P[maxn+1], num[maxn+1]; vector<pair<vector<int>, ll> > knowledge; pair<vector<int>, ll> transaction(ll v) { return {vector<int>(NULL), 0}; } void Sub2_3(ll n) { FOR(i, 1, n-2, 1) { res = transaction(P[i-1]-2); for (auto p : res.fi) num[p]++; if (res.fi[0] != i) P[i] = P[i-1] - 1; else P[i] = P[i-1] - 2; } FOR(i, 1, n-2, 1) FOR(j, num[i], i-1, 1) transaction(P[i]); FOR(j, num[n-1], n-2, 1) transaction(P[n-2]-1); } void Fix(pair<vector<int>, ll>& know) { FOR(i, 0, know.fi.size(), 1) { ll p = know.fi[i]; if (P[p] == 0) continue; know.fi.erase(know.fi.begin() + i); know.se -= P[p]; } } void Sub5(ll n) { ll val = P[0] - 1; while (true) { res = transaction(val); for (auto p : res.fi) num[p]++; res.se = val - res.se; knowledge.pb(res); if (res.fi.size() == 1) P[res.fi[0]] = res.se; if (res.fi[0] == n-1) { P[n-1] = res.se; break; } val = res.se / res.fi.size(); } bool ck = 0; while (!ck) { for (auto know : knowledge) { Fix(know); if (know.fi.size() == 2) { res = transaction(res.se/2); for (auto p : res.fi) num[p]++; res.se = val - res.se; Fix(res); knowledge.pb(res); } else if (know.fi.size() == 1) { ll a = know.fi[0]; P[a] = know.se; } } ck = 1; FOR(i, 1, n-1, 1) if (P[i] == 0) ck = 0; } FOR(i, 1, n-1, 1) FOR(j, num[i], i-1, 1) transaction(P[i]); } // std::pair<std::vector<int>, long long> transaction(long long M) void buy_souvenirs(int n, long long P0) { P[0] = P0; if (n == 2) transaction(P[0]-1); else if (n == 3) { res = transaction(P[0]-1); if (res.fi.size() == 1) { transaction(P[0]-res.se-2); transaction(P[0]-res.se-2); } else transaction((P[0]-1-res.se)/2); } else Sub5(n); }

Compilation message (stderr)

souvenirs.cpp: In function 'std::pair<std::vector<int>, long long int> transaction(ll)':
souvenirs.cpp:25:29: warning: passing NULL to non-pointer argument 1 of 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' [-Wconversion-null]
   25 |     return {vector<int>(NULL), 0};
      |                             ^
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from souvenirs.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:510:24: note:   declared here
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |              ~~~~~~~~~~^~~
/usr/bin/ld: /tmp/ccC5yiAZ.o: in function `transaction(long long)':
stub.cpp:(.text+0x1d0): multiple definition of `transaction(long long)'; /tmp/ccu0FV3b.o:souvenirs.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status