제출 #1130691

#제출 시각아이디문제언어결과실행 시간메모리
1130691LudisseyStrange Device (APIO19_strange_device)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,A,B; cin >> n >> A >> B; vector<pair<int,int>> a(n); for (int i = 0; i < n; i++) { int l,r; cin >> l >> r; a[i]={l,r}; } int s=(a[0].second-a[0].first)+1; int lc=lcm(A,(B+1)%A); if(lc==0){ cout << min(s,B) << "\n"; }else { __uint128_t step=A; step/=__gcd(A,(B+1)%A); if(s/B<step){ cout << min(s,(step)) << "\n"; }else{ step=step*B; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

strange_device.cpp: In function 'int main()':
strange_device.cpp:26:24: error: no matching function for call to 'min(long long int&, __int128 unsigned&)'
   26 |             cout << min(s,(step)) << "\n";
      |                     ~~~^~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from strange_device.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
strange_device.cpp:26:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__int128 unsigned')
   26 |             cout << min(s,(step)) << "\n";
      |                     ~~~^~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from strange_device.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
strange_device.cpp:26:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__int128 unsigned')
   26 |             cout << min(s,(step)) << "\n";
      |                     ~~~^~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from strange_device.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
strange_device.cpp:26:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |             cout << min(s,(step)) << "\n";
      |                     ~~~^~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from strange_device.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
strange_device.cpp:26:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |             cout << min(s,(step)) << "\n";
      |                     ~~~^~~~~~~~~~