#include "rect.h"
#include <vector>
#define sz(a) (a.size())
using namespace std;
long long count_rectangles(vector<vector<int>> a) {
int n = sz(a);
int m = sz(a[0]);
int answer = 0;
for (int r1 = 1; r1 < n-1; ++r1){
for (int c1 = 1; c1 < m-1; ++c1){
for (int r2 = r1; r2 < n-1; ++r2){
for (int c2 = c1; c2 < m-1; ++c2){
bool good = true;
for (int i = r1; i <= r2; ++i){
for (int j = c1; j <= c2; ++j){
if(a[i][j] >= a[i][c1-1] ||
a[i][j] >= a[i][c2+1] ||
a[i][j] >= a[r1-1][j] ||
a[i][j] >= a[r2+1][j]){
good = false;
}
}
}
if(good){
answer++;
}
}
}
}
}
return answer;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
39 ms |
256 KB |
Output is correct |
3 |
Correct |
40 ms |
256 KB |
Output is correct |
4 |
Correct |
39 ms |
364 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
79 ms |
360 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Correct |
77 ms |
388 KB |
Output is correct |
10 |
Correct |
79 ms |
256 KB |
Output is correct |
11 |
Correct |
87 ms |
376 KB |
Output is correct |
12 |
Correct |
76 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
54 ms |
256 KB |
Output is correct |
20 |
Correct |
3 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
39 ms |
256 KB |
Output is correct |
3 |
Correct |
40 ms |
256 KB |
Output is correct |
4 |
Correct |
39 ms |
364 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
79 ms |
360 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Correct |
77 ms |
388 KB |
Output is correct |
10 |
Correct |
79 ms |
256 KB |
Output is correct |
11 |
Correct |
87 ms |
376 KB |
Output is correct |
12 |
Correct |
76 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Execution timed out |
5060 ms |
384 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
39 ms |
256 KB |
Output is correct |
3 |
Correct |
40 ms |
256 KB |
Output is correct |
4 |
Correct |
39 ms |
364 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
79 ms |
360 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Correct |
77 ms |
388 KB |
Output is correct |
10 |
Correct |
79 ms |
256 KB |
Output is correct |
11 |
Correct |
87 ms |
376 KB |
Output is correct |
12 |
Correct |
76 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Execution timed out |
5060 ms |
384 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
39 ms |
256 KB |
Output is correct |
3 |
Correct |
40 ms |
256 KB |
Output is correct |
4 |
Correct |
39 ms |
364 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
79 ms |
360 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Correct |
77 ms |
388 KB |
Output is correct |
10 |
Correct |
79 ms |
256 KB |
Output is correct |
11 |
Correct |
87 ms |
376 KB |
Output is correct |
12 |
Correct |
76 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Execution timed out |
5060 ms |
384 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3772 ms |
468 KB |
Output is correct |
2 |
Correct |
2314 ms |
460 KB |
Output is correct |
3 |
Correct |
1305 ms |
504 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Execution timed out |
5079 ms |
384 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5067 ms |
28416 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
39 ms |
256 KB |
Output is correct |
3 |
Correct |
40 ms |
256 KB |
Output is correct |
4 |
Correct |
39 ms |
364 KB |
Output is correct |
5 |
Correct |
17 ms |
256 KB |
Output is correct |
6 |
Correct |
79 ms |
360 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Correct |
77 ms |
388 KB |
Output is correct |
10 |
Correct |
79 ms |
256 KB |
Output is correct |
11 |
Correct |
87 ms |
376 KB |
Output is correct |
12 |
Correct |
76 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Execution timed out |
5060 ms |
384 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |