Submission #1360523

#TimeUsernameProblemLanguageResultExecution timeMemory
1360523jumpSemiexpress (JOI17_semiexpress)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long
int n,m,k,a,b,c,t;
std::vector<int> stop;
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cin >> n >> m >> k;
  std::cin >> a >> b >> c;
  std::cin >> t;
  for(int i=0;i<m;i++){
    int in;
    std::cin >> in;
    stop.push_back(in);
  }
  std::vector<int> gain;
  for(int i=0;i<m-1;i++){
    int sdist=(stop[i]-1)*b;
    if(sdist>t){
      gain.push_back(0);
      continue;
    }
    int reach = stop[i]+((t-sdist)/a);
    if(reach>=stop[i+1]){
      gain.push_back(0);
      continue;
    }
    int ndist=(stop[i]-1)*b+(stop[i]+reach+1-stop[i])*c;
    if(ndist>t){
      gain.push_back(0);
      continue;
    }
    gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
  }
}

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:33:28: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   33 |     gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from semiexpress.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:33:28: note:   candidate expects 2 arguments, 1 provided
   33 |     gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:33:28: note:   candidate expects 3 arguments, 1 provided
   33 |     gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:33:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |     gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:33:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |     gain.push_back(std::max(stop[i+1]-(reach+stop[i])));
      |                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~