Submission #794349

# Submission time Handle Problem Language Result Execution time Memory
794349 2023-07-26T13:06:48 Z kirakaminski968 Semiexpress (JOI17_semiexpress) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll express[3005],endpos[3005];
int main()
{
  	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    ll N,M,K; cin >> N >> M >> K;
    ll A,B,C; cin >> A >> B >> C;
    ll T; cin >> T;
    for(int i = 1;i<=M;++i){
        cin >> express[i];
        express[i]--;
        endpos[i] = (T-express[i]*B)/A;
        if(endpos[i] < 0) endpos[i] = -1;
    }
    for(int i = 1;i<M;++i) endpos[i] = min(endpos[i],express[i+1]-express[i]-1);
    endpos[M] = min(endpos[M],0);
    for(int i = 0;i<K-M;++i){
        ll maxn = 0, pos = -1;
        for(int j = 1;j<M;++j){
            if((T-express[j]*B-(endpos[j]+1)*C)/A < 0) continue;
            int p = endpos[j]+1;
            int chec = min(express[j+1]-express[j]-1,(T-express[j]*B-p*C)/A+p);
            if(chec-p+1 > maxn){
                maxn = chec-p+1;
                pos = j;
            }
        }
        if(maxn > 0){
            endpos[pos] += maxn;
        }
    }
    ll ans = 0;
    for(int i = 1;i<=M;++i) ans += endpos[i]+1;
    ans--;
    cout << ans << "\n";
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:18:32: error: no matching function for call to 'min(long long int&, int)'
   18 |     endpos[M] = min(endpos[M],0);
      |                                ^
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 semiexpress.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:
semiexpress.cpp:18:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |     endpos[M] = min(endpos[M],0);
      |                                ^
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 semiexpress.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:
semiexpress.cpp:18:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |     endpos[M] = min(endpos[M],0);
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from semiexpress.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:
semiexpress.cpp:18:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |     endpos[M] = min(endpos[M],0);
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from semiexpress.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:
semiexpress.cpp:18:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |     endpos[M] = min(endpos[M],0);
      |                                ^