|
|
вернуться в форумWA 13 Help, pls this is my bad code #include <vector> #include <iostream> #include <cmath> #include <algorithm> #include <stdio.h> using namespace std; struct poi { int x,y; }; vector<poi> g; int n; int ma=0; vector<int> w; bool compare(poi m,poi mm) { if (m.x>mm.x) { return false; } else { return true; } } void dp(int t,int coun) { if (coun>ma) { ma=coun; } for (int x=t+1; x<n; x++) { if ((g[x].x>g[t].x) and (g[x].y>g[t].y) and (coun+1)>w[x]) { w[x]=coun+1; dp(x,coun+1);
} } } int main() { int a,b; poi t; scanf("%d%d%d",&a,&b,&n); w.resize(n); for (int x=0; x<n; x++) { scanf("%d%d",&t.x,&t.y); g.push_back(t); w[x]=0; } sort(g.begin(),g.end(),compare); for (int x=0; x<n; x++) { if (w[x]==0) { w[x]=1; dp(x,1); } } double ras=(a+b-2*ma)*100; ras+=ma*sqrt(20000); printf("%d", int(ras+0.5)); }
what is the test №13 |
|
|