Submission #932374

#TimeUsernameProblemLanguageResultExecution timeMemory
932374salmonShortcut (IOI16_shortcut)C++14
Compilation error
0 ms0 KiB
#include "shortcut.h" #include <bits/stdc++.h> using namespace std; queue<pair<int,int>> q; long long int d[1100100]; long long find_shortcut(int N, vector<int> l, vector<int> d, int c){ long long int small = 1e18; for(int i = 0; i < N; i++){ for(int j = i + 1; j < N; j++){ for(int k = 0; k < N; k++){ long long int big = 0; for(int i = 0; i < N; i++){ d[i] = 1e18; } q.push(0,k); d[k] = 0; while(!q.empty()){ if(d[q.front().second] == q.front().first){ int m = q.front().second; if(m == j){ if(d[m] + c < d[i]){ d[i] = d[m] + c; q.push({d[i],i}); } } else if(m == i){ if(d[m] + c < d[j]){ d[j] = d[m] + c; q.push({d[j],j}); } } if(m != N - 1){ if(d[m + 1] > d[m] + l[m]){ d[m + 1] = d[m] + l[m]; q.push({d[m + 1], m + 1}); } } if(m != 0){ if(d[m - 1] > d[m] + l[m - 1]){ d[m - 1] = d[m - 1] + l[m - 1]; q.push({d[m - 1], m - 1}); } } } q.pop(); } for(int i = 0; i < N; i++){ big = max(big,d[i]); } small = min(small,big); } } } return small; }

Compilation message (stderr)

shortcut.cpp: In function 'long long int find_shortcut(int, std::vector<int>, std::vector<int>, int)':
shortcut.cpp:20:28: warning: overflow in conversion from 'double' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
   20 |                     d[i] = 1e18;
      |                            ^~~~
shortcut.cpp:22:27: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int, int&)'
   22 |                 q.push(0,k);
      |                           ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from shortcut.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note:   candidate expects 1 argument, 2 provided
shortcut.cpp:60:39: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   60 |                     big = max(big,d[i]);
      |                                       ^
In file included from /usr/include/c++/10/vector:60,
                 from shortcut.h:2,
                 from shortcut.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:
shortcut.cpp:60:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   60 |                     big = max(big,d[i]);
      |                                       ^
In file included from /usr/include/c++/10/vector:60,
                 from shortcut.h:2,
                 from shortcut.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:
shortcut.cpp:60:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   60 |                     big = max(big,d[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 shortcut.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:
shortcut.cpp:60:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |                     big = max(big,d[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 shortcut.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:
shortcut.cpp:60:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |                     big = max(big,d[i]);
      |                                       ^