Submission #147521

#TimeUsernameProblemLanguageResultExecution timeMemory
1475212qbingxuanRectangles (IOI19_rect)C++14
0 / 100
2 ms376 KiB
//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \\#################\\
//   \\#################\\
//    \        ____       \
//     \_______\___\_______\
// 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;}

int n,m,v[N][N];
ll count_rectangles(std::vector<std::vector<int> > a) {
    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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...