Submission #1031325

#TimeUsernameProblemLanguageResultExecution timeMemory
1031325LalicRectangles (IOI19_rect)C++17
37 / 100
5077 ms28272 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define mp make_pair typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<double> cd; ll count_rectangles(vector<vector<int>> a){ int n=(int)a.size(), m=(int)a[0].size(); ll ans=0; for(int l1=1;l1<n-1;l1++){ for(int r1=1;r1<m-1;r1++){ for(int l2=l1;l2<n-1;l2++){ for(int r2=r1;r2<m-1;r2++){ bool ok=1; for(int i=l1;i<=l2;i++){ for(int j=r1;j<=r2;j++){ if(a[i][j]>=a[l1-1][j] || a[i][j]>=a[l2+1][j] || a[i][j]>=a[i][r1-1] || a[i][j]>=a[i][r2+1]){ ok=0; break; } } if(!ok) break; } ans+=(ok ? 1ll : 0ll); //~ if(ok) //~ cout << l1 << " " << r1 << "\t" << l2 << " " << r2 << "\n"; } } } } 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...