#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
long long count_rectangles(std::vector<std::vector<int> > a) {
long long ans=0;
int n = a.size();
int m = a[0].size();
for(int r1=1;r1<n-1;r1++) {
for(int r2 = r1;r2<n-1;r2++) {
for(int c1 = 1;c1<m-1;c1++) {
for(int c2 = c1;c2<m-1;c2++) {
bool check=1;
for(int i = r1;i<=r2;i++) {
for(int j = c1;j<=c2;j++) {
if(a[i][j] >= a[i][c1-1] or a[i][j] >= a[i][c2+1] or a[i][j] >= a[r1-1][j] or a[i][j] >= a[r2+1][j]) {
check=false;
break;
}
}
if(!check)break;
}
ans+=check;
}
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
26 ms |
516 KB |
Output is correct |
23 |
Correct |
29 ms |
540 KB |
Output is correct |
24 |
Correct |
25 ms |
348 KB |
Output is correct |
25 |
Correct |
16 ms |
348 KB |
Output is correct |
26 |
Correct |
20 ms |
508 KB |
Output is correct |
27 |
Correct |
18 ms |
524 KB |
Output is correct |
28 |
Correct |
23 ms |
348 KB |
Output is correct |
29 |
Correct |
4 ms |
484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
26 ms |
516 KB |
Output is correct |
18 |
Correct |
29 ms |
540 KB |
Output is correct |
19 |
Correct |
25 ms |
348 KB |
Output is correct |
20 |
Correct |
16 ms |
348 KB |
Output is correct |
21 |
Correct |
20 ms |
508 KB |
Output is correct |
22 |
Correct |
18 ms |
524 KB |
Output is correct |
23 |
Correct |
23 ms |
348 KB |
Output is correct |
24 |
Correct |
4 ms |
484 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
964 ms |
860 KB |
Output is correct |
31 |
Correct |
950 ms |
952 KB |
Output is correct |
32 |
Correct |
921 ms |
860 KB |
Output is correct |
33 |
Correct |
583 ms |
604 KB |
Output is correct |
34 |
Correct |
761 ms |
860 KB |
Output is correct |
35 |
Correct |
792 ms |
1040 KB |
Output is correct |
36 |
Correct |
717 ms |
860 KB |
Output is correct |
37 |
Correct |
737 ms |
856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
26 ms |
516 KB |
Output is correct |
18 |
Correct |
29 ms |
540 KB |
Output is correct |
19 |
Correct |
25 ms |
348 KB |
Output is correct |
20 |
Correct |
16 ms |
348 KB |
Output is correct |
21 |
Correct |
20 ms |
508 KB |
Output is correct |
22 |
Correct |
18 ms |
524 KB |
Output is correct |
23 |
Correct |
23 ms |
348 KB |
Output is correct |
24 |
Correct |
4 ms |
484 KB |
Output is correct |
25 |
Correct |
964 ms |
860 KB |
Output is correct |
26 |
Correct |
950 ms |
952 KB |
Output is correct |
27 |
Correct |
921 ms |
860 KB |
Output is correct |
28 |
Correct |
583 ms |
604 KB |
Output is correct |
29 |
Correct |
761 ms |
860 KB |
Output is correct |
30 |
Correct |
792 ms |
1040 KB |
Output is correct |
31 |
Correct |
717 ms |
860 KB |
Output is correct |
32 |
Correct |
737 ms |
856 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Execution timed out |
5028 ms |
7256 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
348 KB |
Output is correct |
2 |
Correct |
5 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
500 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
8 ms |
348 KB |
Output is correct |
6 |
Correct |
8 ms |
496 KB |
Output is correct |
7 |
Correct |
8 ms |
500 KB |
Output is correct |
8 |
Correct |
8 ms |
496 KB |
Output is correct |
9 |
Correct |
8 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
5072 ms |
28440 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
26 ms |
516 KB |
Output is correct |
18 |
Correct |
29 ms |
540 KB |
Output is correct |
19 |
Correct |
25 ms |
348 KB |
Output is correct |
20 |
Correct |
16 ms |
348 KB |
Output is correct |
21 |
Correct |
20 ms |
508 KB |
Output is correct |
22 |
Correct |
18 ms |
524 KB |
Output is correct |
23 |
Correct |
23 ms |
348 KB |
Output is correct |
24 |
Correct |
4 ms |
484 KB |
Output is correct |
25 |
Correct |
964 ms |
860 KB |
Output is correct |
26 |
Correct |
950 ms |
952 KB |
Output is correct |
27 |
Correct |
921 ms |
860 KB |
Output is correct |
28 |
Correct |
583 ms |
604 KB |
Output is correct |
29 |
Correct |
761 ms |
860 KB |
Output is correct |
30 |
Correct |
792 ms |
1040 KB |
Output is correct |
31 |
Correct |
717 ms |
860 KB |
Output is correct |
32 |
Correct |
737 ms |
856 KB |
Output is correct |
33 |
Execution timed out |
5028 ms |
7256 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |