#include "treasure.h"
#include <iostream>
#define MAXN 100
using namespace std;
int ps[MAXN + 5][MAXN + 5]; // partial sum # treasure
int ans[MAXN + 5][MAXN + 5];
int total = 0;
/*
int countTreasure(int r1, int c1, int r2, int c2) {
cout << r1 << " " << c1 << " " << r2 << " " << c2 << endl;
int val;
cin >> val;
return val;
}*/
void findTreasure(int N) {
ps[N][N] = countTreasure(1, 1, N, N);
for (int r = N; r >= 2; r--) {
for (int c = N; c >= 2; c--) {
cout << r << c << endl;
if (!ps[r][c - 1]) {
ps[r][c - 1] = countTreasure(1, 1, r, c - 1);
}
if (!ps[r - 1][c - 1]) {
ps[r - 1][c - 1] = countTreasure(1, 1, r - 1, c - 1);
}
if (!ps[r - 1][c]) {
ps[r - 1][c] = countTreasure(1, 1, r - 1, c);
}
ans[r][c] = ps[r][c] - ps[r - 1][c] - ps[r][c - 1] + ps[r - 1][c - 1];
cout << endl;
}
}
for (int r = N; r >= 1; r--) {
ans[r][1] = ps[r][2] - ps[r - 1][2] - ans[r][2];
}
for (int c = N; c >= 1; c--) {
ans[1][c] = ps[2][c] - ps[2][c-1] - ans[2][c];
}
for (int r = 1; r <= N; r++) {
for (int c = 1; c <= N; c++) {
if (ans[r][c]) Report(r, c);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Invalid Access |
2 |
Incorrect |
1 ms |
212 KB |
Invalid Access |
3 |
Incorrect |
1 ms |
340 KB |
Invalid Access |
4 |
Incorrect |
1 ms |
340 KB |
Invalid Access |
5 |
Incorrect |
8 ms |
340 KB |
Invalid Access |
6 |
Incorrect |
10 ms |
396 KB |
Invalid Access |
7 |
Incorrect |
15 ms |
468 KB |
Invalid Access |
8 |
Incorrect |
19 ms |
432 KB |
Invalid Access |
9 |
Incorrect |
24 ms |
468 KB |
Invalid Access |
10 |
Incorrect |
26 ms |
440 KB |
Invalid Access |