#include "rect.h"
#include <bits/stdc++.h>
#define ll long long
#define mid ((l+r)>>1)
#define pii pair<int,int>
#define fi first
#define se second
#define rep(a,b,c) for(int a=b; a<c; a++)
#define pb push_back
using namespace std;
ll count_rectangles(vector<vector<int>> a) {
ll ans=0, n=a.size(), m=a[0].size();
rep(ri,1,n-1){
rep(ci,1,m-1){
rep(rf,ri,n-1){
rep(cf,ci,m-1){
bool rect=1;
rep(i,ri,rf+1){
rep(j,ci,cf+1){
if(a[i][j]>=a[ri-1][j] || a[i][j]>=a[rf+1][j] || a[i][j]>=a[i][ci-1] || a[i][j]>=a[i][cf+1]){
rect=false;
break;
}
}
if(!rect) break;
}
ans+=rect;
}
}
}
}
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 |
440 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 |
1 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 |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
348 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 |
440 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 |
1 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 |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
30 ms |
348 KB |
Output is correct |
23 |
Correct |
33 ms |
348 KB |
Output is correct |
24 |
Correct |
31 ms |
344 KB |
Output is correct |
25 |
Correct |
19 ms |
500 KB |
Output is correct |
26 |
Correct |
22 ms |
344 KB |
Output is correct |
27 |
Correct |
22 ms |
344 KB |
Output is correct |
28 |
Correct |
22 ms |
348 KB |
Output is correct |
29 |
Correct |
6 ms |
440 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 |
440 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
30 ms |
348 KB |
Output is correct |
18 |
Correct |
33 ms |
348 KB |
Output is correct |
19 |
Correct |
31 ms |
344 KB |
Output is correct |
20 |
Correct |
19 ms |
500 KB |
Output is correct |
21 |
Correct |
22 ms |
344 KB |
Output is correct |
22 |
Correct |
22 ms |
344 KB |
Output is correct |
23 |
Correct |
22 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
440 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
604 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
1255 ms |
964 KB |
Output is correct |
31 |
Correct |
1268 ms |
956 KB |
Output is correct |
32 |
Correct |
1255 ms |
1040 KB |
Output is correct |
33 |
Correct |
783 ms |
816 KB |
Output is correct |
34 |
Correct |
865 ms |
860 KB |
Output is correct |
35 |
Correct |
896 ms |
860 KB |
Output is correct |
36 |
Correct |
853 ms |
856 KB |
Output is correct |
37 |
Correct |
844 ms |
860 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 |
440 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
30 ms |
348 KB |
Output is correct |
18 |
Correct |
33 ms |
348 KB |
Output is correct |
19 |
Correct |
31 ms |
344 KB |
Output is correct |
20 |
Correct |
19 ms |
500 KB |
Output is correct |
21 |
Correct |
22 ms |
344 KB |
Output is correct |
22 |
Correct |
22 ms |
344 KB |
Output is correct |
23 |
Correct |
22 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
440 KB |
Output is correct |
25 |
Correct |
1255 ms |
964 KB |
Output is correct |
26 |
Correct |
1268 ms |
956 KB |
Output is correct |
27 |
Correct |
1255 ms |
1040 KB |
Output is correct |
28 |
Correct |
783 ms |
816 KB |
Output is correct |
29 |
Correct |
865 ms |
860 KB |
Output is correct |
30 |
Correct |
896 ms |
860 KB |
Output is correct |
31 |
Correct |
853 ms |
856 KB |
Output is correct |
32 |
Correct |
844 ms |
860 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
604 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Execution timed out |
5020 ms |
5920 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
344 KB |
Output is correct |
2 |
Correct |
9 ms |
536 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
9 ms |
348 KB |
Output is correct |
6 |
Correct |
9 ms |
548 KB |
Output is correct |
7 |
Correct |
8 ms |
440 KB |
Output is correct |
8 |
Correct |
8 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 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 |
5087 ms |
25892 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 |
440 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
30 ms |
348 KB |
Output is correct |
18 |
Correct |
33 ms |
348 KB |
Output is correct |
19 |
Correct |
31 ms |
344 KB |
Output is correct |
20 |
Correct |
19 ms |
500 KB |
Output is correct |
21 |
Correct |
22 ms |
344 KB |
Output is correct |
22 |
Correct |
22 ms |
344 KB |
Output is correct |
23 |
Correct |
22 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
440 KB |
Output is correct |
25 |
Correct |
1255 ms |
964 KB |
Output is correct |
26 |
Correct |
1268 ms |
956 KB |
Output is correct |
27 |
Correct |
1255 ms |
1040 KB |
Output is correct |
28 |
Correct |
783 ms |
816 KB |
Output is correct |
29 |
Correct |
865 ms |
860 KB |
Output is correct |
30 |
Correct |
896 ms |
860 KB |
Output is correct |
31 |
Correct |
853 ms |
856 KB |
Output is correct |
32 |
Correct |
844 ms |
860 KB |
Output is correct |
33 |
Execution timed out |
5020 ms |
5920 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |