/*
ID: Sho10
LANG: C++
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll a[2505][2505];
ll count_rectangles(vector<vector<int> >A){
ll n=A.size();
ll m=A[0].size();
ll ans=0;
for(ll i=0;i<n;i++)
for(ll j=0;j<m;j++)
a[i][j]=A[i][j];
for(ll i=1;i<n-1;i++)
for(ll j=1;j<m-1;j++)
{
for(ll c=i;c<n-1;c++)
for(ll k=j;k<m-1;k++){
for(ll ii=i;ii<=c;ii++)
for(ll jj=j;jj<=k;jj++)
{
if(a[ii][jj]<a[ii][j-1]&&a[ii][jj]<a[i-1][jj]&&a[ii][jj]<a[c+1][jj]&&a[ii][jj]<a[ii][k+1]){
continue;
}else goto Next;
}
ans++;
Next:ans=ans+0;
}
}
return ans;
}
/*
int32_t main(){
CODE_START;
cout<<count_rectangles({{4, 8, 7, 5, 6},{7, 4, 10, 3, 5},{9, 7, 20, 14, 2},{9, 14, 7, 3, 6},{5, 7, 5, 2, 7},{4, 5, 13, 5, 6}});
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
504 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
504 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
504 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
256 KB |
Output is correct |
18 |
Correct |
5 ms |
256 KB |
Output is correct |
19 |
Correct |
5 ms |
504 KB |
Output is correct |
20 |
Correct |
5 ms |
380 KB |
Output is correct |
21 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
504 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
504 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
504 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
32 ms |
760 KB |
Output is correct |
18 |
Correct |
31 ms |
760 KB |
Output is correct |
19 |
Correct |
30 ms |
760 KB |
Output is correct |
20 |
Correct |
22 ms |
760 KB |
Output is correct |
21 |
Correct |
25 ms |
764 KB |
Output is correct |
22 |
Correct |
26 ms |
888 KB |
Output is correct |
23 |
Correct |
25 ms |
760 KB |
Output is correct |
24 |
Correct |
10 ms |
760 KB |
Output is correct |
25 |
Correct |
5 ms |
256 KB |
Output is correct |
26 |
Correct |
5 ms |
256 KB |
Output is correct |
27 |
Correct |
5 ms |
504 KB |
Output is correct |
28 |
Correct |
5 ms |
380 KB |
Output is correct |
29 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
504 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
504 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
504 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
32 ms |
760 KB |
Output is correct |
18 |
Correct |
31 ms |
760 KB |
Output is correct |
19 |
Correct |
30 ms |
760 KB |
Output is correct |
20 |
Correct |
22 ms |
760 KB |
Output is correct |
21 |
Correct |
25 ms |
764 KB |
Output is correct |
22 |
Correct |
26 ms |
888 KB |
Output is correct |
23 |
Correct |
25 ms |
760 KB |
Output is correct |
24 |
Correct |
10 ms |
760 KB |
Output is correct |
25 |
Correct |
973 ms |
2144 KB |
Output is correct |
26 |
Correct |
979 ms |
2040 KB |
Output is correct |
27 |
Correct |
970 ms |
2040 KB |
Output is correct |
28 |
Correct |
545 ms |
1912 KB |
Output is correct |
29 |
Correct |
709 ms |
2040 KB |
Output is correct |
30 |
Correct |
705 ms |
2168 KB |
Output is correct |
31 |
Correct |
688 ms |
2168 KB |
Output is correct |
32 |
Correct |
653 ms |
2168 KB |
Output is correct |
33 |
Correct |
5 ms |
256 KB |
Output is correct |
34 |
Correct |
5 ms |
256 KB |
Output is correct |
35 |
Correct |
5 ms |
504 KB |
Output is correct |
36 |
Correct |
5 ms |
380 KB |
Output is correct |
37 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
504 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
504 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
504 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
32 ms |
760 KB |
Output is correct |
18 |
Correct |
31 ms |
760 KB |
Output is correct |
19 |
Correct |
30 ms |
760 KB |
Output is correct |
20 |
Correct |
22 ms |
760 KB |
Output is correct |
21 |
Correct |
25 ms |
764 KB |
Output is correct |
22 |
Correct |
26 ms |
888 KB |
Output is correct |
23 |
Correct |
25 ms |
760 KB |
Output is correct |
24 |
Correct |
10 ms |
760 KB |
Output is correct |
25 |
Correct |
973 ms |
2144 KB |
Output is correct |
26 |
Correct |
979 ms |
2040 KB |
Output is correct |
27 |
Correct |
970 ms |
2040 KB |
Output is correct |
28 |
Correct |
545 ms |
1912 KB |
Output is correct |
29 |
Correct |
709 ms |
2040 KB |
Output is correct |
30 |
Correct |
705 ms |
2168 KB |
Output is correct |
31 |
Correct |
688 ms |
2168 KB |
Output is correct |
32 |
Correct |
653 ms |
2168 KB |
Output is correct |
33 |
Execution timed out |
5017 ms |
11132 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
504 KB |
Output is correct |
3 |
Correct |
8 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
12 ms |
504 KB |
Output is correct |
6 |
Correct |
12 ms |
504 KB |
Output is correct |
7 |
Correct |
12 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
504 KB |
Output is correct |
9 |
Correct |
12 ms |
504 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Execution timed out |
5050 ms |
47480 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
5 ms |
504 KB |
Output is correct |
5 |
Correct |
5 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
504 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
5 ms |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
504 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
504 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
32 ms |
760 KB |
Output is correct |
18 |
Correct |
31 ms |
760 KB |
Output is correct |
19 |
Correct |
30 ms |
760 KB |
Output is correct |
20 |
Correct |
22 ms |
760 KB |
Output is correct |
21 |
Correct |
25 ms |
764 KB |
Output is correct |
22 |
Correct |
26 ms |
888 KB |
Output is correct |
23 |
Correct |
25 ms |
760 KB |
Output is correct |
24 |
Correct |
10 ms |
760 KB |
Output is correct |
25 |
Correct |
973 ms |
2144 KB |
Output is correct |
26 |
Correct |
979 ms |
2040 KB |
Output is correct |
27 |
Correct |
970 ms |
2040 KB |
Output is correct |
28 |
Correct |
545 ms |
1912 KB |
Output is correct |
29 |
Correct |
709 ms |
2040 KB |
Output is correct |
30 |
Correct |
705 ms |
2168 KB |
Output is correct |
31 |
Correct |
688 ms |
2168 KB |
Output is correct |
32 |
Correct |
653 ms |
2168 KB |
Output is correct |
33 |
Execution timed out |
5017 ms |
11132 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |