제출 #891445

#제출 시각아이디문제언어결과실행 시간메모리
891445Sir_Ahmed_ImranRectangles (IOI19_rect)C++17
0 / 100
5044 ms79368 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define N 2500 int l[N][N]; int u[N][N]; int r[N][N]; int d[N][N]; ll count_rectangles(vector<vector<int>> a){ int n,m; n=a.size(); m=a[0].size(); for(int i=1;i<n-1;i++){ for(int j=1;j<m-1;j++){ l[i][j]=l[i-1][j]+(a[i][j]<a[i][j-1]); u[i][j]=u[i][j-1]+(a[i][j]<a[i-1][j]); r[i][j]=r[i-1][j]+(a[i][j]<a[i][j+1]); d[i][j]=d[i][j-1]+(a[i][j]<a[i+1][j]); } } ll o=0; for(int i1=1;i1<n-1;i1++){ for(int j1=1;j1<m-1;j1++){ for(int i2=i1;i2<n-1;i2++){ for(int j2=j1;j2<m-1;j2++){ if(l[i2][j1]-l[i1-1][j1]==i2-i1+1 && u[i1][j2]-u[i1][j1-1]==j2-j1+1 && r[i2][j2]-r[i1-1][j2]==i2-i1+1 && d[i2][j2]-d[i2][j1-1]==j2-j1+1){ o++; } } } } } return o; }
#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...