Submission #746069

# Submission time Handle Problem Language Result Execution time Memory
746069 2023-05-21T10:59:54 Z vjudge1 Kitchen (BOI19_kitchen) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int n, m, k;
int a[301];
int b[301];
int sum = 0;
 
void st1(){
    ll ans = 1e9;
    if (m < k){cout << "Impossible\n";
        return;
    }
    if (k == 1){
        for (int i = 1;i <= m;i++){
            if (b[i] >= sum) {
                ans = min(ans, b[i]);
            }
        }
    }
    int u = 0;
    for (int i = 1;i <= m; i++){
        u += b[i];
    }
    if (u >= sum) {
        ans = min(ans,u);
    }
    if(k == 2 && (b[1] < m || b[2] < m)) cout << "Impossible\n";
    else if (ans == (ll)1e9)cout << "Impossible\n";
    else{
        cout << ans-sum << "\n";
    }
    return;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        sum += a[i];
    }
    for (int i = 1;i <= m; i++){
        cin >> b[i];
    }
    if(m <= 2) st1();
}

Compilation message

kitchen.cpp: In function 'void st1()':
kitchen.cpp:18:36: error: no matching function for call to 'min(ll&, int&)'
   18 |                 ans = min(ans, b[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 kitchen.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:
kitchen.cpp:18:36: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                 ans = min(ans, b[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 kitchen.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:
kitchen.cpp:18:36: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                 ans = min(ans, b[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 kitchen.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:
kitchen.cpp:18:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |                 ans = min(ans, b[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 kitchen.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:
kitchen.cpp:18:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |                 ans = min(ans, b[i]);
      |                                    ^
kitchen.cpp:27:24: error: no matching function for call to 'min(ll&, int&)'
   27 |         ans = min(ans,u);
      |                        ^
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 kitchen.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:
kitchen.cpp:27:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |         ans = min(ans,u);
      |                        ^
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 kitchen.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:
kitchen.cpp:27:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |         ans = min(ans,u);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from kitchen.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:
kitchen.cpp:27:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |         ans = min(ans,u);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from kitchen.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:
kitchen.cpp:27:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |         ans = min(ans,u);
      |                        ^