답안 #1104126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104126 2024-10-23T01:40:39 Z ezzzay Fancy Fence (CEOI20_fancyfence) C++14
12 / 100
92 ms 57316 KB
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
int h[N];
int w[N];
bool arr[5000][5000];
int ps[5000][5000];
signed main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    int x=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w[i];j++){
            for(int k=1;k<=h[i];k++){
                arr[k][x+j]=1;
            }
        }
        x+=w[i];
    }
    for(int i=1;i<=50;i++){
        for(int j=1;j<=50;j++){
            ps[i][j]=ps[i-1][j]+ps[i][j-1]-ps[i-1][j-1]+arr[i][j];
        }
    }
    int ans=0;
    for(int i=1;i<=50;i++){
        for(int j=i;j<=50;j++){
            for(int l=1;l<=50;l++){
                for(int r=l;r<=50;r++){
                    int a=ps[r][j]-ps[r][i-1]-ps[l-1][j]+ps[l-1][i-1];
                    if(a==(j-i+1)*(r-l+1))ans++;
                }
            }
        }
    }
    cout<<ans;
    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Runtime error 48 ms 56724 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Correct 3 ms 4688 KB Output is correct
3 Correct 3 ms 4688 KB Output is correct
4 Correct 4 ms 4856 KB Output is correct
5 Correct 3 ms 4688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Runtime error 92 ms 57316 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 43 ms 56912 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Runtime error 48 ms 56768 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Runtime error 46 ms 56904 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4688 KB Output is correct
2 Runtime error 48 ms 56724 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -