QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#646236#8022. Walkerkans2298Compile Error//C++172.1kb2024-10-16 21:50:452024-10-16 21:50:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-16 21:50:47]
  • 评测
  • [2024-10-16 21:50:45]
  • 提交

answer

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
     int ti,t;
     //freopen("input.in","r",stdin);
     ios::sync_with_stdio(false);
     cin.tie(nullptr);
     cin>>t;
     for (ti=1;ti<=t;++ti)
     {
     double n_,p1_,p2_,n1_,n2_;
     cin>>n_>>p1_>>n1_>>p2_>>n2_;
     long double n=n_*1000,p1=p1_*1000,p2=p2_*1000,n1=n1_*1000,n2=n2_*1000;
     //cout<<n<<" "<<p1<<" "<<p2<<" "<<n1<<" "<<n2<<"\n";
     if (not (p1<=p2))
          {
          swap(p1,p2);
          swap(n1,n2);
          }
     double ans1=1e9;
     ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
     ans1=min(ans1,1.0*(n+min(p2,n-p2))/n2);
     auto check1 = [](long double n, long double p1, long double p2, long double n1, long double n2)
     {
          long double d;
          d = 1.0 * (2 * n * n1 - p2 * n1 + n2 * p1) / (2 * n2 + n1);
          if (d - p1 <= p1 && n - p2 <= p2 - d)
          {
               return d;
          }
          d = 1.0 * (n * n1 + p2 * n1 + n2 * p1) / (2 * (n1 + n2));
          if (d - p1 <= p1 && p2 - d <= n - p2)
          {
               return d;
          }
          d = 1.0 * (2 * n * n1 - p2 * n1 - n2 * p1) / (n1 + n2);
          if (p1 <= d - p1 && n - p2 <= p2 - d)
          {
               return d;
          }
          d = 1.0 * (n * n1 + p2 * n1 - n2 * p1) / (2 * n1 + n2);
          if (p1 <= d - p1 && p2 - d <= n - p2)
          {
               return d;
          }
          return (long double)(-1.0);
     };
     auto door=check1(n,p1,p2,n1,n2);
     long double T=1e9;
     if (p1==p2)
          {
          long double t1=max(p1/n1,(n-p1)/n2);
          long double t2=max(p1/n2,(n-p1)/n1);
          T=min(T,min(t1,t2));
          }
     if (door>0 && p1<=door && door<=p2) T=min(T,(door+min(door-p1,(long double)(p1)))/n1);
     door=p1;
     long double tA=1.0*p1/n1,tB=1.0*(n-p1+min(n-p2,p2-p1))/n2;
     T=min(T,max(tA,tB));
     door=p2;
     tA=1.0*(p2+min(p1,p2-p1))/n1,tB=1.0*(n-p2)/n2;
     T=min(T,max(tA,tB));
     cout<<fixed<<setprecision(8)<<min((long double)(ans1),T)<<"\n";
     }
     return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:25:14: error: no matching function for call to ‘min(double&, long double)’
   25 |      ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/string:51,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:2:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
answer.code:25:14: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’)
   25 |      ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
answer.code:25:14: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’)
   25 |      ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from answer.code:3:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)’
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
answer.code:25:14: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘double’
   25 |      ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
answer.code:25:14: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘double’
   25 |      ans1=min(ans1,1.0*(n+min(p1,n-p1))/n1);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:26:14: error: no matching function for call to ‘min(double&, long double)’
   26 |      ans1=min(ans1,1.0*(n+min(p2,n-p2))/n2);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
answer.code:26:14: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’)
   26 |      ans1=min(ans1,1.0*(n+min(p2,n-p2))/n2);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
answer.code:26:14: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’)
   26 |      ans1=min(ans1,1.0*(n+min(p2,n-p2))/n2);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)’
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
answer.code:26:14: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘double’
   26 |      ans1=min(ans1,1.0*(n+min(p2,n-p2))/n2);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
answer.code:26:14: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘double’
   26 |      ans1=min(ans1,1.0*(n+...