#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());
vector<array<int, 2>> res;
void rec(int a, int b, int c, int d, int cnt) {
if (tie(a, b) == tie(c, d)) {
res.push_back({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));
for (auto [x, y] : res) {
Report(x, y);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct - N = 5, K = 626, score = 0 |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct - N = 10, K = 15930, score = 0 |
3 |
Partially correct |
0 ms |
348 KB |
Output is partially correct - N = 15, K = 50504, score = 1 |
4 |
Partially correct |
0 ms |
344 KB |
Output is partially correct - N = 16, K = 43045, score = 4 |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct - N = 55, K = 11599882, score = 0 |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct - N = 66, K = 22428835, score = 0 |
7 |
Partially correct |
1 ms |
348 KB |
Output is partially correct - N = 77, K = 28751459, score = 1 |
8 |
Incorrect |
0 ms |
604 KB |
Output isn't correct - N = 88, K = 64608965, score = 0 |
9 |
Incorrect |
1 ms |
604 KB |
Output isn't correct - N = 99, K = 138594165, score = 0 |
10 |
Incorrect |
1 ms |
600 KB |
Output isn't correct - N = 100, K = 134745103, score = 0 |