답안 #996581

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996581 2024-06-10T20:30:36 Z MilosMilutinovic 보물 찾기 (CEOI13_treasure2) C++14
33 / 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, total - t);
    }
  }
}

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 Partially correct 1 ms 348 KB Output is partially correct - N = 5, K = 505, score = 8
2 Partially correct 0 ms 348 KB Output is partially correct - N = 10, K = 8221, score = 1
3 Partially correct 0 ms 348 KB Output is partially correct - N = 15, K = 31329, score = 4
4 Partially correct 0 ms 348 KB Output is partially correct - N = 16, K = 34666, score = 8
5 Partially correct 0 ms 348 KB Output is partially correct - N = 55, K = 7743525, score = 1
6 Partially correct 0 ms 348 KB Output is partially correct - N = 66, K = 16560647, score = 1
7 Partially correct 1 ms 504 KB Output is partially correct - N = 77, K = 19732193, score = 4
8 Partially correct 0 ms 604 KB Output is partially correct - N = 88, K = 39228936, score = 4
9 Partially correct 1 ms 348 KB Output is partially correct - N = 99, K = 83150836, score = 1
10 Partially correct 0 ms 604 KB Output is partially correct - N = 100, K = 86629037, score = 1