/**
____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|
**/
#include <bits/stdc++.h>
#include "treasure.h"
using namespace std;
typedef long long ll;
const int N_MAX = 100;
int N;
bool found[N_MAX + 2][N_MAX + 2];
int UL[N_MAX + 2][N_MAX + 2];
int UR[N_MAX + 2][N_MAX + 2];
int DL[N_MAX + 2][N_MAX + 2];
int DR[N_MAX + 2][N_MAX + 2];
void findTreasure(int N) {
// Compute sum of cheaper corner
for (int i = 1; i <= N / 2; i++) {
for (int j = 1; j <= N / 2; j++) {
DR[i][j] = countTreasure(i, j, N, N);
}
}
for (int i = 1; i <= N / 2; i++) {
for (int j = N / 2; j < N; j++) {
DL[i][j] = countTreasure(i, 1, N, j);
}
}
for (int i = 1; i <= N / 2; i++) {
DL[i][N] = DR[i][1];
}
for (int i = N / 2; i < N; i++) {
for (int j = 1; j <= N / 2; j++) {
UR[i][j] = countTreasure(1, j, i, N);
}
}
for (int j = 1; j <= N / 2; j++) {
UR[N][j] = DR[1][j];
}
for (int i = N / 2; i < N; i++) {
for (int j = N / 2; j < N; j++) {
UL[i][j] = countTreasure(1, 1, i, j);
}
}
for (int i = N / 2; i <= N; i++) {
UL[i][N] = UR[i][1];
}
for (int j = N / 2; j <= N; j++) {
UL[N][j] = DL[1][j];
}
// Compute sum of upper-left corner
for (int i = 1; i <= N / 2 - 1; i++) {
for (int j = N / 2; j <= N; j++) {
UL[i][j] = DL[1][j] - DL[i + 1][j];
}
}
for (int i = N / 2; i <= N; i++) {
for (int j = 1; j <= N / 2 - 1; j++) {
UL[i][j] = UR[i][1] - UR[i][j + 1];
}
}
for (int i = 1; i <= N / 2 - 1; i++) {
for (int j = 1; j <= N / 2 - 1; j++) {
UL[i][j] = UL[i][N] + UL[N][j] + DR[i + 1][j + 1] - DR[1][1];
}
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
found[i][j] = UL[i][j] - UL[i - 1][j] - UL[i][j - 1] + UL[i - 1][j - 1];
}
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
if (found[i][j] == true) {
Report(i, j);
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
340 KB |
Output is partially correct - N = 5, K = 326, score = 8 |
2 |
Correct |
0 ms |
340 KB |
Output is correct - N = 10, K = 4475, score = 10 |
3 |
Partially correct |
1 ms |
316 KB |
Output is partially correct - N = 15, K = 22626, score = 8 |
4 |
Correct |
1 ms |
340 KB |
Output is correct - N = 16, K = 28928, score = 10 |
5 |
Partially correct |
1 ms |
340 KB |
Output is partially correct - N = 55, K = 4009826, score = 8 |
6 |
Correct |
0 ms |
444 KB |
Output is correct - N = 66, K = 8305803, score = 10 |
7 |
Partially correct |
1 ms |
468 KB |
Output is partially correct - N = 77, K = 15392054, score = 8 |
8 |
Correct |
1 ms |
468 KB |
Output is correct - N = 88, K = 26244416, score = 10 |
9 |
Partially correct |
1 ms |
468 KB |
Output is partially correct - N = 99, K = 42046902, score = 8 |
10 |
Correct |
1 ms |
468 KB |
Output is correct - N = 100, K = 43760000, score = 10 |