Submission #924215

#TimeUsernameProblemLanguageResultExecution timeMemory
924215dwuyCheap flights (LMIO18_pigus_skrydziai)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL) #define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout) #define fi first #define se second #define endl "\n" #define len(s) int32_t(s.length()) #define MASK(k)(1LL<<(k)) #define TASK "test" #define int long long using namespace std; typedef tuple<int, int, int> tpiii; typedef pair<double, double> pdd; typedef pair<int, int> pii; typedef long long ll; const long long OO = 1e18; const int MOD = 1e9 + 7; const int INF = 1e9; const int MX = 300005; int n, m; int sum[MX]; vector<pii> G[MX]; tpiii edges[MX<<1]; bitset<MX> ok = 0; int cost[MX]; void nhap(){ cin >> n >> m; for(int i=1; i<=m; i++){ int u, v, c; cin >> u >> v >> c; G[u].push_back({v, c}); G[v].push_back({u, c}); edges[i] = {c, u, v}; sum[u] += c; sum[v] += c; } } void solve(){ int ans = 0; for(int i=1; i<=n; i++) ans = max(ans, sum[i]); sort(edges+1, edges+1+m); for(int i=1; i<=min(m, max(1000, m>>1)); i++){ int c, u, v; tie(c, u, v) = edges[i]; for(pii &tmp: G[u]){ int f, k; tie(f, k) = tmp; ok[f] = 1; cost[f] = k; } for(pii &tmp: G[v]){ int f, k; tie(f, k) = tmp; if(ok[f]) ans = max(ans, c + k + cost[f]); } for(pii &tmp: G[u]){ int f, k; tie(f, k) = tmp; ok[f] = cost[f] = 0; } } cout << ans; } int32_t main(){ fastIO; //file(TASK); nhap(); solve(); return 0; }

Compilation message (stderr)

pigus_skrydziai.cpp: In function 'void solve()':
pigus_skrydziai.cpp:49:42: error: no matching function for call to 'max(int, long long int)'
   49 |     for(int i=1; i<=min(m, max(1000, m>>1)); i++){
      |                                          ^
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 pigus_skrydziai.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:
pigus_skrydziai.cpp:49:42: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   49 |     for(int i=1; i<=min(m, max(1000, m>>1)); i++){
      |                                          ^
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 pigus_skrydziai.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:
pigus_skrydziai.cpp:49:42: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   49 |     for(int i=1; i<=min(m, max(1000, m>>1)); i++){
      |                                          ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from pigus_skrydziai.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:
pigus_skrydziai.cpp:49:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   49 |     for(int i=1; i<=min(m, max(1000, m>>1)); i++){
      |                                          ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from pigus_skrydziai.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:
pigus_skrydziai.cpp:49:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   49 |     for(int i=1; i<=min(m, max(1000, m>>1)); i++){
      |                                          ^
pigus_skrydziai.cpp:66:29: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   66 |             ok[f] = cost[f] = 0;
      |                     ~~~~~~~~^~~