#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 1e3 + 5;
int f[N][N], c, h, b;
struct node
{
int t, x;
} e[N];
bool cmp(node a, node b)
{
return a.t < b.t;
}
int main()
{
ios::sync_with_stdio(false), cin.tie(0);
cin >> c >> h >> b, memset(f, 0x3f, sizeof(f));
for (int i = 1; i <= c; i++)
cin >> e[i].x >> e[i].t;
sort(e + 1, e + 1 + c, cmp);
for (int i = 0; i <= h; i++)
f[0][i] = i;
for (int i = 1; i <= c; i++)
for (int j = 0; j <= h; j++)
f[i][j] = min(f[i][j], max(e[i].t, f[i - 1][e[i].x]) + abs(j - e[i].x));
cout << f[c][b] << endl;
}
这个线性DP就36分...去题解区一看都是区间DP,这道题有线性DP正解吗,或者说我的代码错在哪里了呢