답안 #798143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
798143 2023-07-30T11:50:48 Z Mouad_ouj 건포도 (IOI09_raisins) C++17
5 / 100
5000 ms 212 KB
#include<bits/stdc++.h>
#define int long long 
using namespace std;
int tab[51][51];
int solve(int xmin,int xmax,int ymin,int ymax)
{
    int ans=1000*50*51,cur=0;
    for(int x=xmin;x<=xmax;x++)
    {
        for(int y=ymin;y<=ymax;y++)
            cur+=tab[x][y];
    }
    if((xmax-xmin==1 && ymax-ymin==0)||(xmax-xmin==0 && ymax-ymin==1))
    return cur;
    for(int x=xmin+1;x<=xmax;x++)
        ans=min(ans,solve(xmin,x-1,ymin,ymax)+solve(x,xmax,ymin,ymax)+cur);
    for(int y=ymin+1;y<=ymax;y++)
        ans=min(ans,solve(xmin,xmax,ymin,y-1)+solve(xmin,xmax,y,ymax)+cur);
    return ans;
}
signed main()
{
    int n,m;
    cin>>n>>m;
    for(int x=0;x<n;x++)
    {
        for(int y=0;y<m;y++)
            cin>>tab[x][y];
    }
    cout<<solve(0,n-1,0,m-1);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Incorrect 35 ms 212 KB Output isn't correct
6 Execution timed out 5005 ms 212 KB Time limit exceeded
7 Execution timed out 5066 ms 212 KB Time limit exceeded
8 Execution timed out 5019 ms 212 KB Time limit exceeded
9 Execution timed out 5061 ms 212 KB Time limit exceeded
10 Execution timed out 5087 ms 212 KB Time limit exceeded
11 Execution timed out 5087 ms 212 KB Time limit exceeded
12 Execution timed out 5081 ms 212 KB Time limit exceeded
13 Execution timed out 5071 ms 212 KB Time limit exceeded
14 Execution timed out 5063 ms 212 KB Time limit exceeded
15 Execution timed out 5086 ms 212 KB Time limit exceeded
16 Execution timed out 5087 ms 212 KB Time limit exceeded
17 Execution timed out 5081 ms 212 KB Time limit exceeded
18 Execution timed out 5074 ms 212 KB Time limit exceeded
19 Execution timed out 5083 ms 212 KB Time limit exceeded
20 Execution timed out 5055 ms 212 KB Time limit exceeded