|
|
back to boardwhy I'v got WA1 ???? 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 !!!! Please help))) 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; } } void ReadData() { //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(); ReadData(); ............................. ... there was main algorithm code, I didn't paste it here, so I want admins not to delete all this code..... ................................... answTime = T[N+1]; WriteData(); return 0; } |
|
|