#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
int ask(int r1, int c1, int r2, int c2)
{
if (r1 > r2 || c1 > c2)
{
return 0;
}
return countTreasure(r1, c1, r2, c2);
}
const int N = 100 + 7;
int ul[N][N];
int ur[N][N];
int dl[N][N];
int dr[N][N];
void findTreasure(int n)
{
int total = ask(1, 1, n, n);
int half = (n + 1) / 2;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
ul[i][j] = ask(1, 1, i, j);
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
ur[i][j] = ask(1, j, i, n);
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
dl[i][j] = ask(i, 1, n, j);
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
dr[i][j] = ask(i, j, n, n);
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
int val_ij = ul[i][j] - ul[i - 1][j] - ul[i][j - 1] + ul[i - 1][j - 1];
if (val_ij)
{
Report(i, j);
}
}
}
}
Compilation message
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:23:7: warning: unused variable 'total' [-Wunused-variable]
23 | int total = ask(1, 1, n, n);
| ^~~~~
treasure.cpp:24:7: warning: unused variable 'half' [-Wunused-variable]
24 | int half = (n + 1) / 2;
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct - N = 5, K = 1701, score = 0 |
2 |
Incorrect |
0 ms |
340 KB |
Output isn't correct - N = 10, K = 28301, score = 0 |
3 |
Incorrect |
0 ms |
340 KB |
Output isn't correct - N = 15, K = 145801, score = 0 |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct - N = 16, K = 189185, score = 0 |
5 |
Incorrect |
1 ms |
340 KB |
Output isn't correct - N = 55, K = 27128201, score = 0 |
6 |
Incorrect |
1 ms |
468 KB |
Output isn't correct - N = 66, K = 56362285, score = 0 |
7 |
Incorrect |
1 ms |
468 KB |
Output isn't correct - N = 77, K = 104563845, score = 0 |
8 |
Incorrect |
1 ms |
468 KB |
Output isn't correct - N = 88, K = 178568897, score = 0 |
9 |
Incorrect |
1 ms |
468 KB |
Output isn't correct - N = 99, K = 286267609, score = 0 |
10 |
Incorrect |
1 ms |
468 KB |
Output isn't correct - N = 100, K = 298030001, score = 0 |