Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
132916 蔡柏睿 抄近路 C++ Wrong Answer 66 2 MS 264 KB 687 2024-02-26 13:31:55

Tests(6/9):


#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; }


Judgement Protocol: