#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN=100;
short a[mxN+1][mxN+1][mxN+1][mxN+1], b[mxN+1][mxN+1];
inline int qry(int r1, int c1, int r2, int c2) {
if(!a[r1][c1][r2][c2])
a[r1][c1][r2][c2]=countTreasure(r1, c1, r2, c2)+1;
return a[r1][c1][r2][c2]-1;
}
void findTreasure(int n) {
memset(a, 0, sizeof(a));
for(int i=1; i<=n/2; ++i) {
for(int j=1; j<=n/2; ++j)
b[i][j]=qry(1, 1, n, n)-qry(i+1, 1, n, n)-qry(1, j+1, n, n)+qry(i+1, j+1, n, n);
for(int j=n/2+1; j<=n; ++j)
b[i][j]=qry(1, 1, n, j)-qry(i+1, 1, n, j);
}
for(int i=n/2+1; i<=n; ++i) {
for(int j=1; j<=n/2; ++j)
b[i][j]=qry(1, 1, i, n)-qry(1, j+1, i, n);
for(int j=n/2+1; j<=n; ++j)
b[i][j]=qry(1, 1, i, j);
}
for(int i=n; i>=1; --i) {
for(int j=1; j<=n; ++j)
b[i][j]-=b[i-1][j];
for(int j=n; j>=1; --j)
if(b[i][j]-=b[i][j-1])
Report(i, j);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
190 ms |
203896 KB |
Output is correct - N = 5, K = 289, score = 10 |
2 |
Correct |
175 ms |
204072 KB |
Output is correct - N = 10, K = 4475, score = 10 |
3 |
Correct |
168 ms |
204084 KB |
Output is correct - N = 15, K = 22289, score = 10 |
4 |
Correct |
187 ms |
204264 KB |
Output is correct - N = 16, K = 28928, score = 10 |
5 |
Correct |
173 ms |
204264 KB |
Output is correct - N = 55, K = 4005289, score = 10 |
6 |
Correct |
157 ms |
204316 KB |
Output is correct - N = 66, K = 8305803, score = 10 |
7 |
Correct |
173 ms |
204316 KB |
Output is correct - N = 77, K = 15383161, score = 10 |
8 |
Correct |
174 ms |
204392 KB |
Output is correct - N = 88, K = 26244416, score = 10 |
9 |
Correct |
167 ms |
204392 KB |
Output is correct - N = 99, K = 42032201, score = 10 |
10 |
Correct |
192 ms |
204396 KB |
Output is correct - N = 100, K = 43760000, score = 10 |