답안 #931846

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
931846 2024-02-22T12:26:09 Z 12345678 이상한 기계 (APIO19_strange_device) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=1e6+5;
ll n, a, b, l[nx], r[nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>a>>b>>l[0]>>r[0];
    //for (int i=1; i<=20; i++) cout<<i<<' '<<i+(i/b)<<' '<<(i+(i/b))%a<<' '<<i%b<<'\n';
    cout<<min(a*b, r-l+1);
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:15:25: error: no matching function for call to 'min(long long int, long int)'
   15 |     cout<<min(a*b, r-l+1);
      |                         ^
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 strange_device.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:
strange_device.cpp:15:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   15 |     cout<<min(a*b, r-l+1);
      |                         ^
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 strange_device.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:
strange_device.cpp:15:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   15 |     cout<<min(a*b, r-l+1);
      |                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from strange_device.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:
strange_device.cpp:15:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |     cout<<min(a*b, r-l+1);
      |                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from strange_device.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:
strange_device.cpp:15:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |     cout<<min(a*b, r-l+1);
      |                         ^