답안 #18522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18522 2016-02-07T15:07:38 Z eaststar 과수원 (NOI14_orchard) C++14
8 / 25
81 ms 4020 KB
#include <stdio.h>
int a[150][5010];
int main(){
    int i,j,k,l,n,m,ans=1e6,mn,t;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;++i){
        for(j=1;j<=m;++j)scanf("%d",a[i]+j),a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
    }
    for(i=1;i<=n;++i){
        for(j=i;j<=n;++j){
            mn=1e6;
            for(k=1;k<=m;++k){
                t=2*(a[j][k-1]-a[i-1][k-1])-(j-i+1)*k;
                if(mn>t)mn=t;
                t=a[n][m]+(j-i+1)*(k+1)-2*(a[j][k]-a[i-1][k])+mn;
                if(ans>t)ans=t;
            }
        }
    }
    printf("%d",ans);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4020 KB Output is correct
2 Correct 0 ms 4020 KB Output is correct
3 Correct 0 ms 4020 KB Output is correct
4 Correct 0 ms 4020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 80 ms 4016 KB futex (syscall #202) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 4020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4020 KB Output is correct
2 Correct 9 ms 4020 KB Output is correct
3 Correct 6 ms 4020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 81 ms 4016 KB futex (syscall #202) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -