#include "rect.h"
using namespace std;
long long count_rectangles(std::vector<std::vector<int> > grid) {
int n = grid.size();
int m = grid[0].size();
int cnt = 0;
for(int i = 1; i <= n - 2; i++){
for(int j = 1; j <= m - 2; j++){
for(int r = 1; r < n - 1; r++){
if(r + i - 1 >= n - 1)break;
for(int k = 1; k < m - 1; k++){
if(k + j - 1 >= m - 1)break;
bool ok = 1;
for(int a = r; a <= r + i - 1; a++){
if(!ok)break;
for(int b = k; b <= k + j - 1; b++){
if(grid[a][b] >= grid[r - 1][b] || grid[a][b] >= grid[r + i][b] || grid[a][b] >= grid[a][k - 1] || grid[a][b] >= grid[a][k + j]){
ok = 0;
break;
}
}
}
if(ok){
cnt++;
}
}
}
}
}
return cnt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
57 ms |
384 KB |
Output is correct |
18 |
Correct |
51 ms |
384 KB |
Output is correct |
19 |
Correct |
54 ms |
504 KB |
Output is correct |
20 |
Correct |
81 ms |
384 KB |
Output is correct |
21 |
Correct |
100 ms |
384 KB |
Output is correct |
22 |
Correct |
100 ms |
384 KB |
Output is correct |
23 |
Correct |
96 ms |
384 KB |
Output is correct |
24 |
Correct |
25 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
256 KB |
Output is correct |
26 |
Correct |
0 ms |
256 KB |
Output is correct |
27 |
Correct |
2 ms |
256 KB |
Output is correct |
28 |
Correct |
1 ms |
256 KB |
Output is correct |
29 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
57 ms |
384 KB |
Output is correct |
18 |
Correct |
51 ms |
384 KB |
Output is correct |
19 |
Correct |
54 ms |
504 KB |
Output is correct |
20 |
Correct |
81 ms |
384 KB |
Output is correct |
21 |
Correct |
100 ms |
384 KB |
Output is correct |
22 |
Correct |
100 ms |
384 KB |
Output is correct |
23 |
Correct |
96 ms |
384 KB |
Output is correct |
24 |
Correct |
25 ms |
384 KB |
Output is correct |
25 |
Correct |
1997 ms |
896 KB |
Output is correct |
26 |
Correct |
1969 ms |
1016 KB |
Output is correct |
27 |
Correct |
1970 ms |
1016 KB |
Output is correct |
28 |
Correct |
3628 ms |
792 KB |
Output is correct |
29 |
Correct |
4621 ms |
824 KB |
Output is correct |
30 |
Correct |
4597 ms |
980 KB |
Output is correct |
31 |
Correct |
4177 ms |
936 KB |
Output is correct |
32 |
Correct |
4139 ms |
976 KB |
Output is correct |
33 |
Correct |
1 ms |
256 KB |
Output is correct |
34 |
Correct |
0 ms |
256 KB |
Output is correct |
35 |
Correct |
2 ms |
256 KB |
Output is correct |
36 |
Correct |
1 ms |
256 KB |
Output is correct |
37 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
57 ms |
384 KB |
Output is correct |
18 |
Correct |
51 ms |
384 KB |
Output is correct |
19 |
Correct |
54 ms |
504 KB |
Output is correct |
20 |
Correct |
81 ms |
384 KB |
Output is correct |
21 |
Correct |
100 ms |
384 KB |
Output is correct |
22 |
Correct |
100 ms |
384 KB |
Output is correct |
23 |
Correct |
96 ms |
384 KB |
Output is correct |
24 |
Correct |
25 ms |
384 KB |
Output is correct |
25 |
Correct |
1997 ms |
896 KB |
Output is correct |
26 |
Correct |
1969 ms |
1016 KB |
Output is correct |
27 |
Correct |
1970 ms |
1016 KB |
Output is correct |
28 |
Correct |
3628 ms |
792 KB |
Output is correct |
29 |
Correct |
4621 ms |
824 KB |
Output is correct |
30 |
Correct |
4597 ms |
980 KB |
Output is correct |
31 |
Correct |
4177 ms |
936 KB |
Output is correct |
32 |
Correct |
4139 ms |
976 KB |
Output is correct |
33 |
Execution timed out |
5060 ms |
7296 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
512 KB |
Output is correct |
2 |
Correct |
14 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
27 ms |
384 KB |
Output is correct |
6 |
Correct |
26 ms |
384 KB |
Output is correct |
7 |
Correct |
25 ms |
384 KB |
Output is correct |
8 |
Correct |
23 ms |
384 KB |
Output is correct |
9 |
Correct |
22 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5054 ms |
28408 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
57 ms |
384 KB |
Output is correct |
18 |
Correct |
51 ms |
384 KB |
Output is correct |
19 |
Correct |
54 ms |
504 KB |
Output is correct |
20 |
Correct |
81 ms |
384 KB |
Output is correct |
21 |
Correct |
100 ms |
384 KB |
Output is correct |
22 |
Correct |
100 ms |
384 KB |
Output is correct |
23 |
Correct |
96 ms |
384 KB |
Output is correct |
24 |
Correct |
25 ms |
384 KB |
Output is correct |
25 |
Correct |
1997 ms |
896 KB |
Output is correct |
26 |
Correct |
1969 ms |
1016 KB |
Output is correct |
27 |
Correct |
1970 ms |
1016 KB |
Output is correct |
28 |
Correct |
3628 ms |
792 KB |
Output is correct |
29 |
Correct |
4621 ms |
824 KB |
Output is correct |
30 |
Correct |
4597 ms |
980 KB |
Output is correct |
31 |
Correct |
4177 ms |
936 KB |
Output is correct |
32 |
Correct |
4139 ms |
976 KB |
Output is correct |
33 |
Execution timed out |
5060 ms |
7296 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |