답안 #996580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996580 2024-06-10T20:27:34 Z MilosMilutinovic 보물 찾기 (CEOI13_treasure2) C++14
0 / 100
1 ms 604 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, yl, mid, 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, yl, xr, 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();
  int cnt = countTreasure(1, 1, N, N);
  solve(1, N, 1, N, cnt);
  for (auto& p : sol) {
    Report(p.first, p.second);
  }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Error - no treasure at (r, c) : r = 3, c = 3
2 Incorrect 0 ms 360 KB Error - no treasure at (r, c) : r = 2, c = 2
3 Incorrect 0 ms 348 KB Error - no treasure at (r, c) : r = 6, c = 2
4 Incorrect 0 ms 348 KB Error - no treasure at (r, c) : r = 8, c = 4
5 Incorrect 0 ms 348 KB Error - no treasure at (r, c) : r = 6, c = 2
6 Incorrect 0 ms 344 KB Error - no treasure at (r, c) : r = 3, c = 3
7 Incorrect 0 ms 348 KB Error - no treasure at (r, c) : r = 10, c = 2
8 Incorrect 1 ms 348 KB Error - no treasure at (r, c) : r = 9, c = 20
9 Incorrect 0 ms 604 KB Error - no treasure at (r, c) : r = 4, c = 4
10 Incorrect 0 ms 604 KB Error - no treasure at (r, c) : r = 2, c = 2