QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296062#1418. Mountain Rescue Team17Compile Error//C++201.8kb2024-01-02 06:22:212024-01-02 06:22:22

Judging History

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

  • [2024-01-02 06:22:22]
  • 评测
  • [2024-01-02 06:22:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
template<class F>
vector<int> smawk(int h, int w, F f){
  auto dfs = [&](auto self, vector<int> &row, vector<int> &col) -> vector<int>{
    int n = row.size();
    if(n == 0) return {};
    vector<int> ncol;
    ncol.reserve(n);
    for(int i:col){
      while(!ncol.empty() && f(row[ncol.size()-1], ncol.back()) > f(row[ncol.size()-1], i)) ncol.pop_back();
      if(ncol.size() < n) ncol.push_back(i);
    }
    vector<int> row_odd;
    row_odd.reserve(n/2+1);
    for(int i = 1; i < n; i+=2) row_odd.push_back(row[i]);
    vector<int> ans = self(self, row_odd, ncol);
    vector<int> res(n);
    for(int i = 0; i < row_odd.size(); i++) res[i*2+1] = ans[i];
    int j = 0;
    for(int i = 0; i < n; i+=2){
      int last = (i == n-1 ? ncol.back() : res[i+1]);
      res[i] = ncol[j];
      while(ncol[j] < last){
        ++j;
        if(f(row[i], res[i]) > f(row[i], ncol[j])) res[i] = ncol[j];
      }
    }
    return res;
  };
  vector<int> row(h), col(w);
  iota(row.begin(), row.end(), 0);
  iota(col.begin(), col.end(), 0);
  return dfs(dfs, row, col);
}
void Rescue(int R, int C, int RS, int CS, int X){
  auto f1 = [&](int x, int y){
    x = x+1;
    y = CS-y;
    int h = Measure(x, y);
    if(h == X) Pinpoint(x, y);
    return h;
  }
  smawk(RS, CS, f1);
  auto f2 = [&](int x, int y){
    x = x+1;
    y = CS+y;
    int h = Measure(x, y);
    if(h == X) Pinpoint(x, y);
    return h;
  }
  smawk(RS, C-CS+1, f2);
  auto f3 = [&](int x, int y){
    x = RS-x;
    y = CS-y;
    int h = Measure(x, y);
    if(h == X) Pinpoint(x, y);
    return h;
  }
  smawk(R-RS+1, CS, f3);
  auto f4 = [&](int x, int y){
    x = RS-x;
    y = CS+y;
    int h = Measure(x, y);
    if(h == X) Pinpoint(x, y);
    return h;
  }
  smawk(R-RS+1, C-CS+1, f4);
}

详细

answer.code: In function ‘void Rescue(int, int, int, int, int)’:
answer.code:45:3: error: expected ‘,’ or ‘;’ before ‘smawk’
   45 |   smawk(RS, CS, f1);
      |   ^~~~~
answer.code:53:3: error: expected ‘,’ or ‘;’ before ‘smawk’
   53 |   smawk(RS, C-CS+1, f2);
      |   ^~~~~
answer.code:61:3: error: expected ‘,’ or ‘;’ before ‘smawk’
   61 |   smawk(R-RS+1, CS, f3);
      |   ^~~~~
answer.code:69:3: error: expected ‘,’ or ‘;’ before ‘smawk’
   69 |   smawk(R-RS+1, C-CS+1, f4);
      |   ^~~~~