Submit Time:2024-02-26 13:31:55

运行 ID: 132916

#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; struct poi { int x, y; }a[1005]; int f[1005]; bool cmp(poi x, poi y) { return x.y < y.y; } int main() { int n, m, c, maxn = -1; cin >> n >> m >> c; for(int i = 1; i <= c; i++) { cin >> a[i].x >> a[i].y; } sort(a + 1, a + c + 1, cmp); for(int i = 1; i <= c; i++) { f[i] = 1; for(int j = 1; j <= i; j++) { if(a[j].x < a[i].x && a[j].y < a[i].y)f[i] = max(f[i], f[j] + 1); } maxn = max(maxn, f[i]); } double ans = 100 * (1.0 * n + m - 2 * maxn + maxn * sqrt(2)) + 0.5; cout << round(ans) << endl; return 0; }