#include "treasure.h"
int ans[111][111];
int BIT(int i, int j) {
int k, l, imsi = 0;
for(k = i; k > 0; k -= (k & -k)) {
for(l = j; l > 0; l -= (l & -l)) {
imsi += ans[k][l];
}
}
for(k = i - 1; k > 0; k -= (k & -k)) {
for(l = j - 1; l > 0; l -= (l & -l)) {
imsi += ans[k][l];
}
}
for(k = i; k > 0; k -= (k & -k)) {
for(l = j - 1; l > 0; l -= (l & -l)) {
imsi -= ans[k][l];
}
}
for(k = i - 1; k > 0; k -= (k & -k)) {
for(l = j; l > 0; l -= (l & -l)) {
imsi -= ans[k][l];
}
}
return imsi;
}
void findTreasure (int N) {
int i, j;
for(i = 1; i <= N; i++) {
for(j = 1; j <= N; j++) {
ans[i][j] = countTreasure(i - (i & -i) + 1, j - (j & -j) + 1, i, j);
}
}
for(i = 1; i <= N; i++) {
for(j = 1; j <= N; j++) {
if(BIT(i, j)) Report(i, j);
}
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
248 KB |
Output is partially correct - N = 5, K = 569, score = 1 |
2 |
Partially correct |
2 ms |
484 KB |
Output is partially correct - N = 10, K = 9571, score = 1 |
3 |
Partially correct |
2 ms |
484 KB |
Output is partially correct - N = 15, K = 49826, score = 1 |
4 |
Partially correct |
2 ms |
484 KB |
Output is partially correct - N = 16, K = 63488, score = 1 |
5 |
Partially correct |
2 ms |
600 KB |
Output is partially correct - N = 55, K = 9124066, score = 1 |
6 |
Partially correct |
3 ms |
600 KB |
Output is partially correct - N = 66, K = 18912011, score = 1 |
7 |
Partially correct |
3 ms |
608 KB |
Output is partially correct - N = 77, K = 35077745, score = 1 |
8 |
Partially correct |
2 ms |
608 KB |
Output is partially correct - N = 88, K = 59872304, score = 1 |
9 |
Partially correct |
3 ms |
608 KB |
Output is partially correct - N = 99, K = 95931018, score = 1 |
10 |
Partially correct |
3 ms |
608 KB |
Output is partially correct - N = 100, K = 99868624, score = 1 |