Submission #974826

#TimeUsernameProblemLanguageResultExecution timeMemory
974826marinalucaBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define xx first #define yy second #define all (x) begin(x), end(x) #define FOR (i, a, b) for (auto i = (a); i < (b); ++ i) const int NMAX = 1e7; long long ans[11111111], rez[11111111]; long long delivery (int n, int k, int l, int s[]){ for (int i = 1; i <= n; ++ i){ ans[i] = min (s[i - 1] << 1 , l); if (i > k){ ans[i] += ans[i - k]; } } int mini = ans[n]; for (int i = n - 1; i >= 0; -- i){ rez[i] = min ((l - s[i]) << 1, l); if (i + k < n){ rez[i] += rez[i + k]; } mini = min (mini, rez[i] + ans[i]); } return mini; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:21:21: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   21 |     int mini = ans[n];
      |                ~~~~~^
boxes.cpp:27:42: error: no matching function for call to 'min(int&, long long int)'
   27 |         mini = min (mini, rez[i] + ans[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 boxes.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
boxes.cpp:27:42: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   27 |         mini = min (mini, rez[i] + ans[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 boxes.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
boxes.cpp:27:42: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   27 |         mini = min (mini, rez[i] + ans[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 boxes.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
boxes.cpp:27:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |         mini = min (mini, rez[i] + ans[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 boxes.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
boxes.cpp:27:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |         mini = min (mini, rez[i] + ans[i]);
      |                                          ^