#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("popcnt")
#define endl '\n'
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define fls cout.flush()
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using ii = pair<int,int>;
using mii = map<int,int>;
using lld = long double;
void valid(ll in){cout<<((in)?"YES\n":"NO\n");}
ll count_rectangles(vector<vi> a){
ll ans = 0;
int n = sz(a), m=(sz(a[0]));
fore(r1,1,n-1){
fore(c1,1,m-1){
fore(r2,r1,n-1){
fore(c2,c1,m-1){
bool cn = 1;
fore(i,r1,r2+1)
fore(j, c1, c2+1)
cn &= (a[i][j]<min({a[r1-1][j],a[i][c1-1], a[i][c2+1], a[r2+1][j]}));
ans+=cn;
}
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
20 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
20 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
20 ms |
440 KB |
Output is correct |
10 |
Correct |
20 ms |
440 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
24 ms |
604 KB |
Output is correct |
13 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
20 ms |
348 KB |
Output is correct |
20 |
Correct |
3 ms |
412 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
20 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
20 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
20 ms |
440 KB |
Output is correct |
10 |
Correct |
20 ms |
440 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
24 ms |
604 KB |
Output is correct |
13 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
20 ms |
348 KB |
Output is correct |
20 |
Correct |
3 ms |
412 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Execution timed out |
5045 ms |
348 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
20 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
20 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
20 ms |
440 KB |
Output is correct |
10 |
Correct |
20 ms |
440 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
24 ms |
604 KB |
Output is correct |
13 |
Correct |
1 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 |
Execution timed out |
5045 ms |
348 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
20 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
20 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
20 ms |
440 KB |
Output is correct |
10 |
Correct |
20 ms |
440 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
24 ms |
604 KB |
Output is correct |
13 |
Correct |
1 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 |
Execution timed out |
5045 ms |
348 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2684 ms |
344 KB |
Output is correct |
2 |
Correct |
1613 ms |
516 KB |
Output is correct |
3 |
Correct |
2665 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
2727 ms |
348 KB |
Output is correct |
6 |
Correct |
2764 ms |
532 KB |
Output is correct |
7 |
Correct |
2697 ms |
604 KB |
Output is correct |
8 |
Correct |
2694 ms |
348 KB |
Output is correct |
9 |
Correct |
2693 ms |
532 KB |
Output is correct |
10 |
Correct |
1 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
20 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
412 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
5086 ms |
28500 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
20 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
20 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
20 ms |
440 KB |
Output is correct |
10 |
Correct |
20 ms |
440 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
24 ms |
604 KB |
Output is correct |
13 |
Correct |
1 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 |
Execution timed out |
5045 ms |
348 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |