답안 #1087438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087438 2024-09-12T17:52:21 Z juicy 보물 찾기 (CEOI13_treasure2) C++17
0 / 100
1 ms 612 KB
#include "treasure.h"

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void rec(int a, int b, int c, int d, int cnt) {
  if (tie(a, b) == tie(c, d)) {
    Report(a, b);
    return;
  }
  if (rng() % 2 && a != c) {
    int m = (a + c) / 2;
    int x = countTreasure(a, b, m, d);
    if (x) {
      rec(a, b, m, d, x);
    }
    if (x < cnt) {
      rec(m + 1, b, c, d, cnt - x);
    }
  } else {
    int m = (b + d) / 2;
    int x = countTreasure(a, b, c, m);
    if (x) {
      rec(a, b, c, m, x);
    }
    if (x < cnt) {
      rec(a, m + 1, c, d, cnt - x);
    } 
  }
}

void findTreasure (int n) {
  rec(1, 1, n, n, countTreasure(1, 1, n, n));
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 612 KB Error - you cannot call countTreasure() after calling Report()
2 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
3 Incorrect 0 ms 508 KB Error - you cannot call countTreasure() after calling Report()
4 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
5 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
6 Incorrect 1 ms 344 KB Error - you cannot call countTreasure() after calling Report()
7 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
8 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
9 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()
10 Incorrect 0 ms 348 KB Error - you cannot call countTreasure() after calling Report()