This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std ;
#define pb push_back
#define C continue 
#define lb lower_bound
typedef long long ll ;
typedef vector < int > vi ;
#include "rect.h"
int n , m ;
int a [3][2509] ;
long long count_rectangles ( vector <vi> A ) {
        n = A .size () ;
        m = A [0] .size () ; 
        for ( int i = 0 ; i < n ; i ++ ) {
                for ( int j = 0 ; j < m ; j ++ ) {
                        a [i][j] = A [i][j] ;
                }
        }
        if ( n <= 2 ) return 0 ;
        ll ans = 0 ;     
        for ( int i = 1 ; i < m - 1 ; i ++ ) {
                int mx = 0 ;
                for ( int j = i ; j < m -1 ; j ++ ) {
                        mx = max ( mx , a [1][j] ) ; 
                        if ( min ( a [0][j] , a [2][j] ) <= a [1][j] ) break ;
                        ans += ( min ( a [1][i-1] , a [1][j+1] ) > mx ) ;
                }
        }
        return ans ;
}
| # | 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... |