QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295869#1418. Mountain Rescue Team17Compile Error//C++201.3kb2024-01-01 13:15:322024-01-01 13:15:33

Judging History

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

  • [2024-01-01 13:15:33]
  • 评测
  • [2024-01-01 13:15:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
pair<int, int> Rescue2(int Rl, int Rr, int Cl, int Cr, int MR, int MC, int X){
  int c = 0;
  map<int, pair<int, int>> m;
  for(int i = Rl; i <= Rr; i++){
    for(int j = Cl; j <= Cr; j++){
      m[abs(i-MR)+abs(j-MC)] = {i, j};
      c = max(c, abs(i-MR)+abs(j-MC));
    }
  }
  int l = 0, r = c;
  while(r-l > 1){
    int mid = (l+r)/2;
    int x = m[mid].first, y = m[mid].second;
    int h = Measure(x, y);
    if(h == X){
      return {x, y};
    }
    if(h < X) r = mid;
    else l = mid;
  }
  for(int i = Rl; i <= Rr; i++){
    for(int j = Cl; j <= Cr; j++){
      int k = abs(i-MR)+abs(j-MC);
      if(k == l || k == r){
        int h = Measure(i, j);
        if(h == X) return {i, j};
      }
    }
  }
  return {-1, -1};
}
void Rescue(int R, int C, int MR, int MC, int X){
  pair<int, int> p;
  p = Rescure(1, MR, 1, MC, MR, MC, X);
  if(p != make_pair(-1, -1)) Pinpoint(p.first, p.second);
  p = Rescure(1, MR, MC, C, MR, MC, X);
  if(p != make_pair(-1, -1)) Pinpoint(p.first, p.second);
  p = Rescure(MR, R, 1, MC, MR, MC, X);
  if(p != make_pair(-1, -1)) Pinpoint(p.first, p.second);
  p = Rescure(MR, R, MC, C, MR, MC, X);
  if(p != make_pair(-1, -1)) Pinpoint(p.first, p.second);
}

Details

answer.code: In function ‘void Rescue(int, int, int, int, int)’:
answer.code:37:7: error: ‘Rescure’ was not declared in this scope; did you mean ‘Rescue’?
   37 |   p = Rescure(1, MR, 1, MC, MR, MC, X);
      |       ^~~~~~~
      |       Rescue