This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// __________________
// | ________________ |
// || ____ ||
// || /\ | ||
// || /__\ | ||
// || / \ |____ ||
// ||________________||
// |__________________|
// \\#################\\
// \\#################\\
// \ ____ \
// \_______\___\_______\
// An AC a day keeps the doctor away.
#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) (cerr<<#x<<" = "<<(x)<<'\n')
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define pb emplace_back
#define ff first
#define ss second
#define mid (l+(r-l>>1))
using namespace std;
using namespace __gnu_pbds;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
typedef pair<ll,ll> pll;
template <typename T> using rkt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
constexpr ld PI = acos(-1), eps = 1e-8;
constexpr ll N = 2525, INF = 1e18, MOD = 998244353, K = 102425;
constexpr inline ll cdiv(ll x, ll m) { return (x+m-1)/m; } // ceiling divide, x/m for flooring divide
template <typename T> void M(T &x, ll m = MOD){x%=m; if(x<0) x+=m;}
ll count_rectangles(std::vector<std::vector<int> > v) {
int n = v.size(), m = v[0].size();
ll res = 0;
for(int l = 1; l < n-1; l++) {
for(int r = l; r < n-1; r++) {
for(int a = 1; a < m-1; a++) {
for(int b = a; b < m-1; b++) {
bool valid = true;
for(int i = l; i <= r; i++) for(int j = a; j <= b; j++) {
if(v[i][j] >= v[l-1][j]) valid = false;
if(v[i][j] >= v[r+1][j]) valid = false;
if(v[i][j] >= v[i][a-1]) valid = false;
if(v[i][j] >= v[i][b+1]) valid = false;
}
if(valid) res++;
}
}
}
}
return res;
}
Compilation message (stderr)
rect.cpp:9:1: warning: multi-line comment [-Wcomment]
// \\#################\\
^
rect.cpp:16:0: warning: ignoring #pragma loop_opt [-Wunknown-pragmas]
#pragma loop_opt(on)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |