你猜到我用的暴力写的吗?我感觉能写,不过需要的时间很多……,我直接醉了,看题解算了,裂开裂开。手写一个模拟堆就行,至于我为什么这么想,我也不清楚。明明就有无后效性的性质,为什么我不用DP。我裂开。
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
const int N = 12;
#define x first
#define y second
typedef pair<int,int> PII;
int n,m,k;
int a[N][N],s[N][N];
double res = 0x3f3f3f3f;
priority_queue<pair<double,pair<PII,PII>> heap;
double get_s()
{
}
void dfs()
{
if(heap.size() == k)
{
res = min(res,get_s());
return;
}
auto t = heap.top();
heap.pop();
int x1 = t.y.x.x, y1 = t.y.x.y;
int x2 = t.y.y.x, y2 = t.y.y.y;
if(x1 > x2) swap(x1,x2),swap(y1,y2);
if(x1 == x2 && y1 == y2) return;
//横着切
for(int i = x1 + 1; i < x2; i++)
{
}
//竖着切
}
int main()
{
cin >> n >> m >> k;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++) cin >> a[i][j];
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
dfs();
cout << res;
return 0;
}