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

wrong answer in the test 13th pleas help me (c++)
Posted by capitan.ARA.code 12 Jul 2020 13:20
this is my code
#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
int n,m,a[2000][2000],dp[2000][2000],k1[200],k2[200],k;
pair<int,int>p[2000];
int main()
{

    cin>>m>>n;
    k=0;
    if(n!=0 && m!=0)
        cin>>k;
    for(int i=1;i<=k;i++)
    {
        cin>>k1[i]>>k2[i];
        p[i].first=k1[i];
        p[i].second=k2[i];
    }
    for(int i=1;i<=m+1;i++)
        for(int j=1;j<=n+1;j++)
        {
            a[i][j]=0;
        }
    for(int i=1;i<=m+1;i++)
        for(int j=1;j<=n+1;j++)
            a[p[i].first][p[i].second]=1;
    for(int i=m+1;i>=1;i--)
        for(int j=n+1;j>=1;j--)
        {
            if(a[i][j]==1)
                dp[i][j]=max(dp[i][j+1],dp[i+1][j+1])+a[i][j];
            else
                dp[i][j]=max(dp[i][j+1],dp[i+1][j])+a[i][j];
        }
    double ans,ao;
    ao=m+n-(dp[1][1]*2);
    ao*=100;
    ans=dp[1][1]*141.42135623730950488016887242097;
    ans+=ao;
    cout<<round(ans)<<endl;
}

Edited by author 12.07.2020 13:33
Re: wrong answer in the test 13th pleas help me (c++)
Posted by kerpoo 12 Jul 2020 14:26
didn't u meaned please instead of pleas?
and "on the" instead of "in the"?

there is some tests that k>m and k>n that's your mistake!

Edited by author 12.07.2020 14:26
Re: wrong answer in the test 13th pleas help me (c++)
Posted by capitan.ARA.code 12 Jul 2020 15:21
i am sorry i can not speak and write English and it is a wrong of type and why?

Edited by author 12.07.2020 15:22

Edited by author 12.07.2020 15:22