ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1119. Metro

WA 13 Help, pls
Posted by Minayev {SESC USU} 2 Nov 2014 17:16
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