Submission #465216

#TimeUsernameProblemLanguageResultExecution timeMemory
465216Vladth11Bulldozer (JOI17_bulldozer)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize("Ofast,unroll-loops") using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair <ll, ll> pii; typedef pair <long double, pii> muchie; typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> OST; const ll NMAX = 2001; const ll INF = (1LL << 60); const ll HALF = (1LL << 59); const ll MOD = 1000000007; const ll BLOCK = 318; const ll base = 31; ll n; class All{ public: struct Node{ ll st, dr, total; ll ssm; }; Node all[NMAX * 4]; Node combine(Node a, Node b){ Node rez; rez.st = max({a.st, a.total + b.st, 0}); rez.dr = max({b.dr, b.total + a.dr, 0}); rez.total = a.total + b.total; rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm return rez; } void update(ll node, ll st, ll dr, ll a, ll b){ if(st == dr){ //b = max(b, 0); all[node] = {max(b, 0), max(0, b), b, max(0, b)}; return; } ll mid = (st + dr) / 2; if(a <= mid){ update(node * 2, st, mid, a, b); }else{ update(node * 2 + 1, mid + 1, dr, a, b); } all[node] = combine(all[node * 2], all[node * 2 + 1]); } Node best(){ return all[1]; } }st; struct poll{ ll x, y, val; }; poll v[NMAX], a[NMAX]; map <pii, ll> mp; struct event{ pii p; double timp; }; vector <event> events; bool cmp(event a, event b){ return a.timp < b.timp; } ///De analizat void swapElements(ll a, ll b){ st.update(1, 1, n, mp[{v[a].x, v[a].y}], v[b].val); st.update(1, 1, n, mp[{v[b].x, v[b].y}], v[a].val); swap(mp[{v[b].x, v[b].y}], mp[{v[a].x, v[a].y}]); } ///De analizat bool cmpp(poll a, poll b){ if(a.x != b.x) return a.x < b.x; return a.y > b.y; } void compute(ll i, ll j){ events.push_back({{i, j}, (double)(v[i].y - v[j].y) / (double)(v[i].x - v[j].x)}); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll i; cin >> n; for(i = 1; i <= n; i++){ cin >> v[i].x >> v[i].y >> v[i].val; } sort(v + 1, v + n + 1, cmpp); for(i = 1; i <= n; i++){ for(ll j = i + 1; j <= n; j++){ compute(i, j); } } for(i = 1; i <= n; i++){ st.update(1, 1, n, i, v[i].val); mp[{v[i].x, v[i].y}] = i; } cout << st.best().ssm; return 0; }

Compilation message (stderr)

bulldozer.cpp: In member function 'All::Node All::combine(All::Node, All::Node)':
bulldozer.cpp:33:47: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   33 |         rez.st = max({a.st, a.total + b.st, 0});
      |                                               ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:33:47: note:   candidate expects 2 arguments, 1 provided
   33 |         rez.st = max({a.st, a.total + b.st, 0});
      |                                               ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:33:47: note:   candidate expects 3 arguments, 1 provided
   33 |         rez.st = max({a.st, a.total + b.st, 0});
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:33:47: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   33 |         rez.st = max({a.st, a.total + b.st, 0});
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:33:47: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   33 |         rez.st = max({a.st, a.total + b.st, 0});
      |                                               ^
bulldozer.cpp:34:47: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   34 |         rez.dr = max({b.dr, b.total + a.dr, 0});
      |                                               ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:34:47: note:   candidate expects 2 arguments, 1 provided
   34 |         rez.dr = max({b.dr, b.total + a.dr, 0});
      |                                               ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:34:47: note:   candidate expects 3 arguments, 1 provided
   34 |         rez.dr = max({b.dr, b.total + a.dr, 0});
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:34:47: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   34 |         rez.dr = max({b.dr, b.total + a.dr, 0});
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:34:47: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   34 |         rez.dr = max({b.dr, b.total + a.dr, 0});
      |                                               ^
bulldozer.cpp:36:53: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   36 |         rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm
      |                                                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:36:53: note:   candidate expects 2 arguments, 1 provided
   36 |         rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm
      |                                                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:36:53: note:   candidate expects 3 arguments, 1 provided
   36 |         rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm
      |                                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:36:53: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   36 |         rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm
      |                                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:36:53: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
   36 |         rez.ssm = max({a.ssm, b.ssm, a.dr + b.st, 0}); ///hmmm
      |                                                     ^
bulldozer.cpp: In member function 'void All::update(ll, ll, ll, ll, ll)':
bulldozer.cpp:42:34: error: no matching function for call to 'max(ll&, int)'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                  ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                  ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                  ^
bulldozer.cpp:42:45: error: no matching function for call to 'max(int, ll&)'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:45: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:45: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bulldozer.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bulldozer.cpp:42:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                             ^
bulldozer.cpp:42:59: error: no matching function for call to 'max(int, ll&)'
   42 |             all[node] = {max(b, 0), max(0, b), b, max(0, b)};
      |                                                           ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 fro