ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1205. By the Underground or by Foot?

why I'v got WA1 ????
Posted by Anton Silin (YarSU) 19 Mar 2008 11:11
the 1st test is like the sample
cout << "2.6346295\n;
cout << "4 4 2 1 3"    passed 1st test!

My program (on my PC) gives the right aswer on this test too, but Judge gives me WA1 !!!!
Code:

#include "fstream.h"
#include "iostream.h"
#include "stdio.h"
#include "math.h"

struct Point
{
float x,y;
};

float Vmin, Vmax;
int N;
Point map[202];           // ìàññèâ êîîðäèíàò
Point A,B;                // A - èíäåêñ 0, Â - èíäåêñ 202  N+1
float gr[202][202];       // ìàòðèöà ñâÿçíîñòè, âðåìÿ ïðîõîäà
float T[202];          // ìàññèâ âðåìåíè ïðîõîäà äî âåðøèíû
int D[400];               // î÷åðåäü

float answTime = 0;
int comeTo[202];        // êóäà èäòè èç ýòîé âåðøèíû?

void Init()
{
for( int i=0; i<202; i++)
{
map[i].x = map[i].y = -1;
T[i] = -1.0;
comeTo[i] = -1;
for ( int j=0; j<202; j++ )
gr[i][j] = -1;
}
}

{
//ifstream input("input.txt");
cin >> Vmin >> Vmax;
cin >> N;
for( int i=1; i<=N; i++)
cin >> map[i].x >> map[i].y;
int a,b;
do
{
cin >> a >> b;
gr[a][b] = gr[b][a] = 1;
} while ( a!=0 || b!=0);
cin >> A.x >> A.y >> B.x >> B.y;
map[0].x = A.x;  map[0].y = A.y;
map[N+1].x = B.x; map[N+1].y = B.y;
}

void WriteData()
{
printf( "%.7f \n", answTime);

int path[202];
int steps = 0;
int i=N+1;      // ôèíèø
while( i!=0 && i!=-1)
{
i = comeTo[i];
path[steps++] = i;
}
steps -= 1;
cout << steps;
for( int j=steps-1; j>=0; j-- )
cout << " " << path[j];

}

int main(int argc, char* argv[])
{
Init();