QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295838#1418. Mountain Rescue Team17Compile Error//C++20913b2024-01-01 12:31:192024-01-01 12:31:19

Judging History

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

  • [2024-01-01 12:31:19]
  • 评测
  • [2024-01-01 12:31:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
void Rescue(int R, int C, int MR, int MC, int X){
  int l = 0, r = max(MR, R-MR+1) + max(MC, C-MR+1) - 2;
  while(r-l > 2){
    int mid = (l+r)/2;
    int x = MR, y = MC;
    int d = mid;
    if(MR < R-MR+1){
      x += min(R-MR, d);
      d -= min(R-MR, d);
    }else{
      x -= min(MR-1, d);
      d -= min(MR-1, d);
    }
    if(MC < C-MC+1){
      y += min(C-MC d);
      d -= min(C-MC, d);
    }else{
      y -= min(MC-1, d);
      d -= min(MC-1, d);
    }
    int h = Measure(x, y);
    if(h == X){
      Pinpoint(x, y);
      return;
    }
    if(h < X) r = mid;
    else l = mid-1;
  }
  for(int i = 1; i <= R; i++){
    for(int j = 1; j <= C; j++){
      int k = abs(i-MR)+abs(j-MC);
      if(k == l || k == r){
        int h = Measure(i, j);
        if(h == X) Pinpoint(i, j);
      }
    }
  }
}

Details

answer.code: In function ‘void Rescue(int, int, int, int, int)’:
answer.code:18:20: error: expected ‘)’ before ‘d’
   18 |       y += min(C-MC d);
      |               ~    ^~
      |                    )
answer.code:18:15: error: no matching function for call to ‘min(int)’
   18 |       y += min(C-MC d);
      |            ~~~^~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code: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:
answer.code:18:15: note:   candidate expects 2 arguments, 1 provided
   18 |       y += min(C-MC d);
      |            ~~~^~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code: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:
answer.code:18:15: note:   candidate expects 3 arguments, 1 provided
   18 |       y += min(C-MC d);
      |            ~~~^~~~~~~
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 answer.code: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:
answer.code:18:15: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   18 |       y += min(C-MC d);
      |            ~~~^~~~~~~
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 answer.code: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:
answer.code:18:15: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   18 |       y += min(C-MC d);
      |            ~~~^~~~~~~