Submission #996579

# Submission time Handle Problem Language Result Execution time Memory
996579 2024-06-10T20:26:33 Z MilosMilutinovic Treasure (different grader from official contest) (CEOI13_treasure2) C++14
Compilation error
0 ms 0 KB
#include "treasure.h"
#include <bits/stdc++.h>

using namespace std;

vector<pair<int, int>> sol;

void solve(int xl, int xr, int yl, int yr, int total) {
  if (xl == xr && yl == yr) {
    sol.emplace_back(xl, yl);
    return;
  }
  int lx = xr - xl, ly = yr - yl;
  if (lx > ly) {
    int mid = (xl + xr) / 2;
    int t = countTreasure(xl, mid, yl, yr);
    if (t != 0) {
      solve(xl, mid, yl, yr, t);
    }
    if (t != total) {
      solve(mid + 1, xr, yl, yr, total - t);
    }
  } else {
    int mid = (yl + yr) / 2;
    int t = countTreasure(xl, xr, yl, mid);
    if (t != 0) {
      solve(xl, xr, yl, mid, t);
    }
    if (t != total) {
      solve(xl, xr, mid + 1, yr, t - total);
    }
  }
}

void findTreasure(int N) {
  sol.clear();
  solve(1, N, 1, N);
  int cnt = countTreasure(1, 1, N, N);
  for (auto& p : sol) {
    Report(p.first, p.second);
  }
}

Compilation message

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:37:19: error: too few arguments to function 'void solve(int, int, int, int, int)'
   37 |   solve(1, N, 1, N);
      |                   ^
treasure.cpp:8:6: note: declared here
    8 | void solve(int xl, int xr, int yl, int yr, int total) {
      |      ^~~~~
treasure.cpp:38:7: warning: unused variable 'cnt' [-Wunused-variable]
   38 |   int cnt = countTreasure(1, 1, N, N);
      |       ^~~