(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1123628

#TimeUsernameProblemLanguageResultExecution timeMemory
1123628marinalucaTraffic (IOI10_traffic)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "traffic.h" #pragma GCC optimize ("O3") #pragma GCC optimize ("fast-math") #pragma GCC optimize ("unroll-loops") using namespace std; //#define int long long #define ll long long #define all (x) begin(x), end(x) #define xx first #define yy second using pii = pair <int, int>; using tii = tuple <int, int, int>; constexpr int NMAX = (int) 1e6; vector <int> ans[NMAX + 1]; ll lazy[NMAX + 1]; ll cp[NMAX + 1]; ll s, maxi; int rez; inline void dfs (int nod, int parent) { int maxi = 0; for (auto elem : ans[nod]) { if (elem != parent) { dfs (elem, nod); lazy[nod] += lazy[elem]; maxi = max (maxi, lazy[elem]); } } cp[nod] = maxi; } int LocateCentre(int n,int p[],int s[],int d[]) { maxi = INT_MIN; rez = -1; for (int i = 0; i < n; ++ i) { lazy[i] = p[i]; s += lazy[i]; } for (int i = 0; i < n - 1; ++ i) { ans[s[i]].push_back(d[i]); ans[d[i]].push_back(s[i]); } dfs (0, -1); for (int i = 0; i < n; ++ i) { cp[i] = max (cp[i], s - lazy[i]); if (cp[i] < mini) { mini = cp[i]; rez = i; } } return rez; }

Compilation message (stderr)

traffic.cpp: In function 'void dfs(int, int)':
traffic.cpp:35:23: error: no matching function for call to 'max(int&, long long int&)'
   35 |            maxi = max (maxi, lazy[elem]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from traffic.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
traffic.cpp:35:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   35 |            maxi = max (maxi, lazy[elem]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from traffic.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
traffic.cpp:35:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   35 |            maxi = max (maxi, lazy[elem]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from traffic.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
traffic.cpp:35:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |            maxi = max (maxi, lazy[elem]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from traffic.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
traffic.cpp:35:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |            maxi = max (maxi, lazy[elem]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:57:21: error: no matching function for call to 'max(long long int&, int*)'
   57 |         cp[i] = max (cp[i], s - lazy[i]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from traffic.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
traffic.cpp:57:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int*')
   57 |         cp[i] = max (cp[i], s - lazy[i]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from traffic.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
traffic.cpp:57:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int*')
   57 |         cp[i] = max (cp[i], s - lazy[i]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from traffic.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
traffic.cpp:57:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   57 |         cp[i] = max (cp[i], s - lazy[i]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from traffic.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
traffic.cpp:57:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   57 |         cp[i] = max (cp[i], s - lazy[i]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
traffic.cpp:58:21: error: 'mini' was not declared in this scope
   58 |         if (cp[i] < mini)
      |                     ^~~~