Submission #428544

#TimeUsernameProblemLanguageResultExecution timeMemory
428544MOUF_MAHMALATRectangles (IOI19_rect)C++14
25 / 100
5057 ms34848 KiB
#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll n,m,a[2509][2509];
long long ans;
void best(ll x,ll y,ll xx,ll yy)
{
    for(ll i=x; i<=xx; i++)
        for(ll j=y; j<=yy; j++)
            if(a[i][j]>=min(min(a[x-1][j],a[xx+1][j]),min(a[i][y-1],a[i][yy+1])))
                return;
    ans++;
}
long long count_rectangles(vector<vector<int> > v)
{
    n=v.size();
    m=v[0].size();
    for(ll i=0; i<n; i++)
        for(ll j=0; j<m; j++)
            a[i][j]=v[i][j];
    for(ll i=1; i<n-1; i++)
        for(ll j=1; j<m-1; j++)
            for(ll o=i; o<n-1; o++)
                for(ll p=j; p<m-1; p++)
                       best(i,j,o,p);
                    return ans;
}
#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...