# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40786 | esspks21 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 3 ms | 676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
#include <vector>
using namespace std;
struct pos { int r, c; };
vector<pos> vt;
// int countTreasure(int r1, int c1, int r2, int c2);
bool findEdge(int r, int c, int n) {
int res = 0;
int mid = n >> 1;
if (r == 1 || c == 1) {
res = countTreasure(r, c, r, c);
}
else if (r < mid && c < mid) { // 왼위
res = countTreasure(r, c, n, n)
- countTreasure(r + 1, c, n, n)
- countTreasure(r, c + 1, n, n)
+ countTreasure(r + 1, c + 1, n, n);
}
else if (r < mid && c >= mid) { // 오위
res = countTreasure(r, 1, n, c)
- countTreasure(r, 1, n, c - 1)
- countTreasure(r + 1, 1, n, c)
+ countTreasure(r + 1, 1, n, c - 1);
}
else if (r >= mid && c < mid) { // 왼아
res = countTreasure(1, c, r, n)
- countTreasure(1, c + 1, r, n)
- countTreasure(1, c, r - 1, n)
+ countTreasure(1, c + 1, r - 1, n);
}
else {
res = countTreasure(1, 1, r, c)
- countTreasure(1, 1, r - 1, c)
- countTreasure(1, 1, r, c - 1)
+ countTreasure(1, 1, r - 1, c - 1);
}
if (res == 1) return true;
return false;
}
void findTreasure(int N) {
//int cnt = countTreasure(1, 1, N, N);
//if (cnt == 0) return;
pos tmp;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
if (findEdge(i, j, N)) {
tmp.r = i; tmp.c = j;
vt.push_back(tmp);
}
}
}
for (int i = 0; i < vt.size(); i++)
Report(vt[i].r, vt[i].c);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |