Submission #1016808

#TimeUsernameProblemLanguageResultExecution timeMemory
1016808NValchanovMagic Show (APIO24_show)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "Alice.h" #define endl '\n' using namespace std; typedef long long ll; vector < pair < int, int > > Alice() { int n = setN(5000); vector < pair < int, int > > edges; for(int i = 1; i < n; i++) { edges.push_back({x % i + 1, i}); } return edges; }
#include <bits/stdc++.h> #include "Bob.h" #define endl '\n' using namespace std; typedef long long ll; /// EXTENDED GCD :( pair < ll, pair < ll, ll > > extgcd(ll a, ll b) { if(b == 0) return {a, {1, 0}}; pair < ll, pair < ll, ll > > g = extgcd(b, a % b); ll d = g.first; ll x = g.second.first; ll y = g.second.second; ll x1 = y; ll y1 = x - y * (a / b); return {d, {x1, y1}}; } ll Bob(vector < pair < int, int > > edges) { /// CRT ll l = 0; ll ans = 0; for(pair < int, int > e : edges) { ll u = e.first; ll v = e.second; if(u > v) swap(u, v); u--; v--; if(ans == 0) { ans = u; l = v; continue; } pair < ll, pair < ll , ll > > g = extgcd(l, v); ll d = g.first; ll x = g.second.first; ll y = g.second.second; ans = ans + (x * (u - ans) / d) % (v / d) * l; l = l * v / d; ans = (ans + l) % l; if(l >= 1e18) break; } return ans; }

Compilation message (stderr)

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:16:20: error: 'x' was not declared in this scope
   16 |   edges.push_back({x % i + 1, i});
      |                    ^
Alice.cpp:16:33: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   16 |   edges.push_back({x % i + 1, i});
      |                                 ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Alice.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~

Bob.cpp: In function 'll Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:59:12: warning: unused variable 'y' [-Wunused-variable]
   59 |         ll y = g.second.second;
      |            ^