Submission #1064428

#TimeUsernameProblemLanguageResultExecution timeMemory
1064428anangoFriend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include "friend.h" #include <bits/stdc++.h> #define int long long using namespace std; int INF = 1LL<<60; // Find out best sample signed findSample(signed n,signed confidence[],signed host[],signed protocol[]){ int ans=10; //let 0 denote i, 1 denote the friends of i //let dp0[i] = answer if we are allowed 0 or 1 //dp1[i] = answer if we're only allowed 0 //dp2[i] = answer if we're only allowed 1 //dp3[i] = answer if we're allowed neither //in the subtree of i int ma = -INF; for (int i=0; i<n; i++) { ma=max(ma,confidence[i]); } return ma; }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:18:32: error: no matching function for call to 'max(long long int&, int&)'
   18 |         ma=max(ma,confidence[i]);
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from friend.cpp:2:
/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:
friend.cpp:18:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |         ma=max(ma,confidence[i]);
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from friend.cpp:2:
/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:
friend.cpp:18:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |         ma=max(ma,confidence[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 friend.cpp:2:
/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:
friend.cpp:18:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |         ma=max(ma,confidence[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 friend.cpp:2:
/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:
friend.cpp:18:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |         ma=max(ma,confidence[i]);
      |                                ^
friend.cpp:9:6: warning: unused variable 'ans' [-Wunused-variable]
    9 |  int ans=10;
      |      ^~~