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>
#define int long long
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n;cin>>n;
int a[55][55];
for(int i=0;i<55;i++){
for(int j=0;j<55;j++){
a[i][j]=0;
}
}
for(int i=0;i<n;i++){
int h;cin>>h;
for(int j=0;j<h;j++){
a[i][j]=1;
}
}
int ans=0;
for(int i=0;i<55;i++){
for(int j=0;j<55;j++){
for(int x=0;x<55;x++){
if(x+i>=55)break;
for(int y=0;y<55;y++){
if(y+j>=55)break;
bool v=1;
for(int xx=x;xx<=x+i;xx++){
for(int yy=y;yy<=y+j;yy++){
if(a[xx][yy]==0){
v=0;break;
}
}
}
if(v==1)ans++;
}
}
}
}
cout<<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... |