10203  Snow Clearing
Moderator: Board moderators
10203  Snow Clearing
it says that...all roads are perfectly straight, with one lane in each direction ...
it means that every road has two lane ???
(from begin to end & from end to begin )
if it is, each graph's vertex should always have even degree, and Euler circuit always exist ...
if not, why sample output is 3:55?
I am confuse...can anybody help me? thx...
it means that every road has two lane ???
(from begin to end & from end to begin )
if it is, each graph's vertex should always have even degree, and Euler circuit always exist ...
if not, why sample output is 3:55?
I am confuse...can anybody help me? thx...

 Guru
 Posts: 724
 Joined: Wed Dec 19, 2001 2:00 am
 Location: Germany
10203
I thot this is very easy...
just sum all the distances,double the distance and divide by 20...
but this is getting WA....
can anybody help me with this...
[/code]
just sum all the distances,double the distance and divide by 20...
but this is getting WA....
can anybody help me with this...
Code: Select all
#include <stdio.h>
#include <math.h>
void main()
{
float sum,x_start,x_end,y_start,y_end;
float x1,y1,x2,y2,dis,x_dif,y_dif,min_time,gap,dif;
long hour,minute,hanger_x,hanger_y,n,x,gap_dif;
scanf("%ld",&n);
for(x=0;x<n;x++)
{
scanf("%ld %ld",&hanger_x,&hanger_y);
sum=0;
while(scanf("%f %f %f %f",&x1,&y1,&x2,&y2)==4)
{
x_start=x1/1000;
y_start=y1/1000;
x_end=x2/1000;
y_end=y2/1000;
x_dif=x_endx_start;
if(x_dif<0)
x_dif=(1.0)*x_dif;
y_dif=y_endy_start;
if(y_dif<0)
y_dif=(1.0)*y_dif;
dis=sqrt((x_dif*x_dif)+(y_dif*y_dif));
sum+=dis;
}
min_time=sum/10.0;
hour=(long)min_time;
dif=min_timehour;
gap=(min_timehour)*60;
gap_dif=(long)gap;
if((gapgap_dif)>0.00)
minute=(long)(gap+1);
else if((gapgap_dif)==0.00)
minute=(long)gap;
printf("%ld:%ld\n",hour,minute);
}
}
10203 is the judge wrong?
Even the official solution from Waterloo gets wa on this problem.

 Guru
 Posts: 724
 Joined: Wed Dec 19, 2001 2:00 am
 Location: Germany
This problem is in multiple input format, so of course the waterloo solution gets WA because it expects other input format.
If you don't know multiple input format, read here: http://onlinejudge.uva.es/problemset/minput.html
Each problem with a blue checkmark or with a green checkmark is in multiple input format.
If you don't know multiple input format, read here: http://onlinejudge.uva.es/problemset/minput.html
Each problem with a blue checkmark or with a green checkmark is in multiple input format.

 New poster
 Posts: 14
 Joined: Tue Feb 03, 2004 3:43 am
10203 Snow Clearing
I'm quite sure my code is correct, could anyone tell me what's wrong, cos I keep on getting WA....
[cpp]
#include <cstdio>
#include <cmath>
#include <cstring>
#define DEBUG(var) cout << #var << " = " << var << endl;
#define LINE cout << __LINE__ << endl;
const int MAX_LINE_LEN = 100;
void test();
int main() {
/*
test();
return 0;
*/
int n_cases;
double distance;
int x1, y1, x2, y2;
double time;
int hour, minute;
char buf[ MAX_LINE_LEN ];
scanf( "%d", &n_cases );
for( int case_num = 0; case_num < n_cases; case_num++ ) {
distance = 0;
scanf( "%d %d\n", &x1, &y1 );
while( fgets( buf, MAX_LINE_LEN, stdin ) != NULL ) {
if( buf[ 0 ] == '\n' )
break;
sscanf( buf, "%d %d %d %d", &x1, &y1, &x2, &y2 );
distance += sqrt( (x1x2)*(x1x2) + (y1y2)*(y1y2) );
}
time = distance / 10000.0;
hour = (int) time;
minute = (int) ((time  hour) * 60 + 0.5);
if( minute == 60 ) {
minute = 0;
hour++;
}
if( case_num != 0 )
printf( "\n" );
printf( "%d:", hour );
if( minute < 10 )
printf( "0%d\n", minute );
else
printf( "%d\n", minute );
}
return 0;
}
/*
* Test values:
* 2.99 2:59
* 2.9999 3:00
* 3.001 3:00
* 3.01 3:01
*/
void test() {
float time;
int hour, minute;
time = 3.01;
hour = (int) time;
minute = (int) ((time  hour) * 60 + 0.5);
if( minute == 60 ) {
minute = 0;
hour++;
}
printf( "%d:", hour );
if( minute < 10 )
printf( "0%d\n", minute );
else
printf( "%d\n", minute );
}
[/cpp]
[cpp]
#include <cstdio>
#include <cmath>
#include <cstring>
#define DEBUG(var) cout << #var << " = " << var << endl;
#define LINE cout << __LINE__ << endl;
const int MAX_LINE_LEN = 100;
void test();
int main() {
/*
test();
return 0;
*/
int n_cases;
double distance;
int x1, y1, x2, y2;
double time;
int hour, minute;
char buf[ MAX_LINE_LEN ];
scanf( "%d", &n_cases );
for( int case_num = 0; case_num < n_cases; case_num++ ) {
distance = 0;
scanf( "%d %d\n", &x1, &y1 );
while( fgets( buf, MAX_LINE_LEN, stdin ) != NULL ) {
if( buf[ 0 ] == '\n' )
break;
sscanf( buf, "%d %d %d %d", &x1, &y1, &x2, &y2 );
distance += sqrt( (x1x2)*(x1x2) + (y1y2)*(y1y2) );
}
time = distance / 10000.0;
hour = (int) time;
minute = (int) ((time  hour) * 60 + 0.5);
if( minute == 60 ) {
minute = 0;
hour++;
}
if( case_num != 0 )
printf( "\n" );
printf( "%d:", hour );
if( minute < 10 )
printf( "0%d\n", minute );
else
printf( "%d\n", minute );
}
return 0;
}
/*
* Test values:
* 2.99 2:59
* 2.9999 3:00
* 3.001 3:00
* 3.01 3:01
*/
void test() {
float time;
int hour, minute;
time = 3.01;
hour = (int) time;
minute = (int) ((time  hour) * 60 + 0.5);
if( minute == 60 ) {
minute = 0;
hour++;
}
printf( "%d:", hour );
if( minute < 10 )
printf( "0%d\n", minute );
else
printf( "%d\n", minute );
}
[/cpp]
For God so loved the world, that he gave his only Son, that whoever believes in him should not perish but have eternal life.
(John 3:16)
(John 3:16)

 Guru
 Posts: 834
 Joined: Wed May 29, 2002 4:11 pm
 Location: Wroclaw, Poland
 Contact:
Think again  it's not good to use flating numbers ... exists simple solution which operates only on integers
Best regards
DM
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that  about impossible ... and you'll get, what you want ....
Born from ashes  restarting counter of problems (800+ solved problems)
Born from ashes  restarting counter of problems (800+ solved problems)

 New poster
 Posts: 14
 Joined: Tue Feb 03, 2004 3:43 am

 Guru
 Posts: 834
 Joined: Wed May 29, 2002 4:11 pm
 Location: Wroclaw, Poland
 Contact:
Sorry, I make wrong comment I see ...
My solution is mainly the same (counting distance) ... but I in different way compute time ...
Best regards
DM
My solution is mainly the same (counting distance) ... but I in different way compute time ...
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that  about impossible ... and you'll get, what you want ....
Born from ashes  restarting counter of problems (800+ solved problems)
Born from ashes  restarting counter of problems (800+ solved problems)
10203
What's wrong with the following results?
input:
output:
And  if nothings's wrong, why do I get WA?
I've tried int, long and double as coordinate types (in C).
input:
Code: Select all
3
0 0
0 0 10000 10000
5000 10000 5000 10000
5000 10000 10000 10000
0 0
0 0 19999 0
10 10
10000 10000 10000 10000
10000 10000 10000 10000
10000 10000 10000 10000
10000 10000 10000 10000
298 837 276 876
10000 0 10000 0
Code: Select all
3:55
2:00
11:01
I've tried int, long and double as coordinate types (in C).
10203
Hi,
Can any one help me,what's wrong with the code that's why i am getting
wrong answer ? Or, can any one give me some test cases?
Here is my code.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
double x,y,a,b,c,d,r,sum,v,sec,min,hour,integer;
int main(){
int tcase,n;
v=50.0/9.0;
//freopen("input.txt","r",stdin);
scanf("%d",&tcase);
while(tcase){
scanf("%lf %lf\n",&x,&y);
sum=0.0;
while(scanf("%lf %lf %lf %lf\n",&a,&b,&c,&d)==4){
r=sqrt((ac)*(ac)+(bd)*(bd));
sum+=r*2;
}
min=(sum/v)/60.0;
hour=min/60.0;
min=modf(hour,&integer);
if((min*60.0)>0&&(min*60.0)<10) printf("%.0lf:0%.0lf\n",integer,(min*60.0)+.05);
else if((min*60.0)>59.0){
integer+=1;
min=0;
printf("%.0lf:0%.0lf\n",integer,min);
}
else printf("%.0lf:%.0lf\n",integer,(min*60.0)+.05);
putchar(10);
}
return 0;
}
Thanks.
"Still, I like her ."
Can any one help me,what's wrong with the code that's why i am getting
wrong answer ? Or, can any one give me some test cases?
Here is my code.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
double x,y,a,b,c,d,r,sum,v,sec,min,hour,integer;
int main(){
int tcase,n;
v=50.0/9.0;
//freopen("input.txt","r",stdin);
scanf("%d",&tcase);
while(tcase){
scanf("%lf %lf\n",&x,&y);
sum=0.0;
while(scanf("%lf %lf %lf %lf\n",&a,&b,&c,&d)==4){
r=sqrt((ac)*(ac)+(bd)*(bd));
sum+=r*2;
}
min=(sum/v)/60.0;
hour=min/60.0;
min=modf(hour,&integer);
if((min*60.0)>0&&(min*60.0)<10) printf("%.0lf:0%.0lf\n",integer,(min*60.0)+.05);
else if((min*60.0)>59.0){
integer+=1;
min=0;
printf("%.0lf:0%.0lf\n",integer,min);
}
else printf("%.0lf:%.0lf\n",integer,(min*60.0)+.05);
putchar(10);
}
return 0;
}
Thanks.
"Still, I like her ."