11958 - Coming Home

All about problems in Volume 119. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

truewt
New poster
Posts: 6
Joined: Thu Apr 14, 2011 9:34 am

11958 - Coming Home

Post by truewt » Thu Apr 14, 2011 9:37 am

Code: Select all

Thanks AC!
Can anybody help? I am getting WA for this simple problem.. Or is this as simple as I thought it to be??
Last edited by truewt on Sat Apr 16, 2011 3:04 pm, edited 1 time in total.

asif_iut
New poster
Posts: 16
Joined: Mon Nov 01, 2010 8:08 am

Re: 11958 - Coming Home

Post by asif_iut » Fri Apr 15, 2011 4:55 pm

your code fails for the following test case:

1 20:00
19:00 60

the correct output is 1440 mins ( 23 hrs till the bus comes and another 60 mins for travelling )

hope it helps

truewt
New poster
Posts: 6
Joined: Thu Apr 14, 2011 9:34 am

Re: 11958 - Coming Home

Post by truewt » Sun Apr 17, 2011 9:43 am

Thanks for the help! I wasn't expecting the case when it goes on to the next day... tricky!

Anm Arif
New poster
Posts: 1
Joined: Tue Jul 05, 2011 5:08 pm

11958 Why Wa..plz help..

Post by Anm Arif » Wed Jul 06, 2011 10:56 am

Code: Select all

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	double i,j,k,h1,D,A,m1,X,d1,l,t,H,M,g;
	char ch;
	cin>>t;
	if(t>0 && t<=100)
	{
		for(i=1;i<=t;i++)
		{
			cin>>k>>H>>ch>>M;
			if(k>=1 && k<=100 && H>=0 && H<=23 && M>=0 && M<=59)
			{
				for(l=0;l<k;l++)
				{
					cin>>h1>>ch>>m1>>d1;
					if(h1>=0 && h1<=23 && m1>=0 && m1<=59 && d1>=0 && d1<=1000)
					{
						if(m1>=M)
						{
							X=m1-M;
							if(h1>=H)
							{
								A=h1-H;
								A=A*60;
							}
							else
							{
								h1=h1+24;
								A=h1-H;
								A=A*60;
							}
							D=X+A+d1;
						}
						else
						{
							m1=m1+60;
							H++;
							X=m1-M;
							if(h1>=H)
							{
								A=h1-H;
								A=A*60;
							}
							else
							{
								h1=h1+24;
								A=h1-H;
								A=A*60;
							}
							D=X+A+d1;
						}
						if(l==0)
							g=D;
						if(l!=0 && D<g)
							g=D;
					}
				}
				cout<<"Case "<<i<<": "<<g<<endl;
			}
		}
	}
	return 0;
}



john_cu_cse
New poster
Posts: 5
Joined: Mon Mar 21, 2011 4:53 pm

Re: 11958 - Coming Home

Post by john_cu_cse » Fri Jul 15, 2011 10:54 am

#include<stdio.h>
int main()
{
int a,b,c,d,e,f,g,h,k,dif,T,i,j;
char z;
scanf("%d",&T);
for(i=1;i<=T;i++)
{
scanf("%d%d%c%d",&a,&b,&z,&c);
g=b*60+c;
for(j=1;j<=a;j++)
{
scanf("%d%c%d%d",&d,&z,&e,&f);
if(j==a)
{
h=d*60+e;
dif=h-g+f;
if(d<=b)
{
k=24*60-g;
dif=d*60+e+k+f;
}
printf("Case %d: %d\n",i,dif);
}
}
}
return 0;
}
always found wrong answer...whats wrong in my code..

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11958 - Coming Home

Post by naseef_07cuet » Thu Jul 21, 2011 7:36 am

Its an easy problem....you can think in much simpler way....only tricky case is the bus might be in the next day....

Happy coding...
If you have determination, you can do anything you want....:)

MarcoL
New poster
Posts: 1
Joined: Fri Feb 10, 2012 2:07 pm

Re: 11958 - Coming Home

Post by MarcoL » Fri Feb 10, 2012 2:10 pm

How is the simpler way to think of it naseef?

EasterSudharta
New poster
Posts: 1
Joined: Tue Feb 21, 2012 7:38 am

Re: 11958 - Coming Home

Post by EasterSudharta » Tue Feb 21, 2012 7:44 am

I was simple than i thought it should be. :lol:
smooth away
The inspiration of the almighty gives man understanding.

Nafis0001
New poster
Posts: 6
Joined: Fri Mar 23, 2012 10:02 pm

Re: 11958 - Coming Home

Post by Nafis0001 » Fri Mar 23, 2012 10:28 pm

why wrong ans????Help!!!




#include<stdio.h>
int main()
{int n,a[105],b[105],c,d,i,j,k,f,h,g;char p,q;
scanf("%d",&n);
for(i=1;i<=n;i++)
{scanf("%d%d:%d",&k,&c,&f);
for(j=1;j<=k;j++)
scanf("%d:%d%d",&a[j],&b[j],&d);h=0;
for(j=1;j<=k;j++)
{if(a[j]<c)
a[j]=a[j]+24;
g=((a[j]*60+b[j])-(c*60+f));
g=g+d;
if(g>h)
h=g;}
printf("Case %d: %d\n",i,h);}
return 0;}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11958 - Coming Home

Post by brianfry713 » Wed Mar 28, 2012 12:00 am

Try the input in the second post of this thread.
Check input and AC output for thousands of problems on uDebug!

shondhi
New poster
Posts: 25
Joined: Tue Oct 02, 2012 5:24 pm
Location: Chittagong
Contact:

11958 - Coming Home

Post by shondhi » Fri Apr 12, 2013 4:23 pm

Code: Select all

Got AC
Last edited by shondhi on Sat Apr 13, 2013 6:07 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11958 - Coming Home

Post by brianfry713 » Sat Apr 13, 2013 2:04 am

See:http://acm.uva.es/board/viewtopic.php?t=53824

Try input:

Code: Select all

100
3 01:39
07:47 227
23:53 901
22:44 432
18 05:40
19:50 369
11:03 1000
04:03 982
08:45 377
09:25 502
14:40 508
17:11 572
11:50 880
04:28 153
08:25 977
00:56 335
23:11 111
03:51 482
21:24 475
20:01 598
23:04 21
04:37 384
12:36 223
6 16:15
10:41 538
21:45 948
14:57 901
18:40 751
18:42 255
14:26 545
5 13:45
02:05 462
11:33 268
10:30 871
13:33 9
22:06 143
20 00:23
11:30 575
23:28 852
03:31 230
09:55 903
06:14 68
21:37 297
09:48 470
05:05 739
10:03 771
00:22 901
00:14 930
20:37 341
10:33 299
06:10 91
15:40 49
10:26 938
03:03 597
06:48 762
06:22 662
08:22 242
7 02:20
14:58 591
07:48 53
03:34 719
03:38 446
00:48 698
15:31 432
10:25 829
4 23:20
03:43 231
21:41 402
10:12 366
00:43 973
20 03:27
04:54 89
09:34 259
01:18 642
19:44 705
06:07 188
02:22 861
01:36 314
03:02 787
19:26 309
11:05 562
18:01 946
15:02 510
13:27 572
22:03 37
00:37 360
18:31 890
20:09 870
07:00 705
10:55 676
20:34 836
11 05:12
21:44 84
23:25 697
07:15 864
00:40 413
16:10 313
10:22 484
05:57 328
01:07 902
16:28 176
19:30 987
08:15 40
12 19:35
01:02 819
19:06 890
17:14 448
07:49 356
14:18 235
09:35 254
03:07 30
00:51 507
01:39 629
23:42 907
15:19 602
22:26 751
10 12:45
06:07 763
22:14 74
04:59 44
17:03 660
02:43 135
01:56 64
11:20 841
01:03 851
01:37 650
19:18 650
9 00:08
10:03 746
22:19 654
14:04 168
17:54 466
03:19 223
04:18 100
11:47 835
17:48 864
02:12 767
20 08:07
16:55 347
02:57 615
16:11 120
13:20 894
17:23 131
06:51 462
18:18 484
22:12 797
06:42 152
01:22 956
20:02 658
06:56 643
03:05 647
04:30 327
11:48 511
01:54 951
17:52 798
21:02 282
06:37 363
06:54 71
16 02:09
19:00 676
09:55 351
14:23 144
19:10 832
20:27 16
21:32 490
00:58 395
07:32 597
12:26 933
16:54 704
01:49 328
11:02 730
14:44 719
00:16 569
01:52 721
01:25 17
6 05:29
15:04 600
19:57 525
04:13 673
16:30 701
11:54 941
10:12 350
12 12:34
23:26 308
01:39 319
16:36 154
09:27 407
02:34 510
02:51 464
07:35 600
22:46 904
16:12 416
10:24 280
08:23 710
06:28 721
11 13:38
04:34 41
10:41 342
01:07 19
09:30 86
11:33 252
12:17 555
01:27 405
18:03 61
18:57 555
00:20 592
15:24 113
18 02:01
13:51 6
21:24 266
11:51 889
20:15 505
02:32 155
11:55 785
00:41 81
17:29 675
23:48 719
03:05 691
09:47 29
09:44 269
12:23 320
00:32 775
13:14 50
13:53 116
00:53 683
05:34 160
14 21:07
14:05 61
16:02 868
14:51 862
23:56 130
16:56 925
05:02 800
14:39 541
14:44 902
15:13 744
09:26 732
20:32 287
05:37 201
00:15 480
04:42 390
4 11:11
18:56 33
19:14 115
01:40 922
13:55 152
17 20:00
16:45 773
01:14 262
12:26 671
10:06 339
01:21 896
16:43 806
05:26 810
13:16 23
18:57 820
15:13 668
03:05 993
04:30 855
17:22 503
02:33 107
05:58 800
11:26 883
17:59 467
18 04:27
21:10 731
16:30 747
07:57 250
00:49 840
06:35 785
03:37 186
11:30 815
08:57 489
12:02 313
11:51 713
06:12 298
11:44 223
09:55 41
00:31 524
10:38 935
11:33 324
12:32 651
00:40 881
14 05:29
10:52 203
11:15 509
10:02 865
08:11 248
07:47 31
11:14 70
15:53 868
19:17 219
22:09 236
09:03 180
15:41 828
03:28 962
20:18 2
08:42 6
17 01:45
04:37 636
17:16 885
20:03 847
08:37 409
12:47 679
05:18 350
14:09 135
07:17 713
01:18 617
23:14 267
00:30 499
07:28 317
07:48 356
04:56 646
23:24 688
21:45 991
16:00 448
4 23:03
09:52 216
09:43 331
02:19 633
01:38 503
16 21:07
05:14 529
05:49 831
19:15 582
16:19 302
14:23 953
17:36 226
19:49 509
11:39 26
21:20 483
04:08 74
11:05 646
18:50 987
14:10 776
12:06 673
09:56 883
06:41 428
8 04:42
23:15 713
11:41 910
14:25 522
06:24 977
16:10 540
19:17 279
14:29 876
16:38 777
10 00:51
06:15 794
12:27 527
17:06 384
07:00 868
09:42 857
21:02 881
07:58 459
11:36 174
09:08 328
07:57 565
19 07:20
02:47 540
06:16 505
06:04 485
00:17 246
05:02 432
09:09 411
18:24 268
12:09 676
09:56 897
14:35 668
14:37 295
10:11 492
12:58 547
02:22 291
19:31 393
23:53 80
08:27 634
06:44 927
23:29 427
15 23:20
11:05 561
00:39 206
09:43 693
22:26 198
16:21 650
05:24 858
04:33 351
15:15 613
15:30 352
12:16 443
20:04 64
02:40 448
19:13 406
14:39 806
11:23 512
12 17:13
05:57 381
22:04 224
15:07 542
01:56 920
10:56 26
16:46 848
14:29 875
00:47 654
23:10 167
00:02 497
02:07 343
04:45 410
15 04:45
14:29 341
06:07 387
19:47 631
11:54 971
09:18 406
01:17 828
13:06 574
02:00 503
12:40 656
02:06 645
12:56 512
13:27 9
19:26 582
16:49 988
22:34 12
8 00:15
19:05 779
13:44 438
22:56 822
04:39 465
06:07 288
13:08 522
19:32 883
17:04 218
9 02:41
06:41 160
13:37 279
18:54 945
23:33 189
08:17 424
04:48 582
01:17 4
12:01 768
02:22 884
18 06:44
06:28 418
16:41 141
23:59 375
06:22 621
01:23 224
04:07 521
09:32 332
15:57 46
01:39 246
07:36 609
07:06 839
05:14 706
03:05 991
00:15 819
10:33 704
14:37 110
17:34 15
02:26 633
13 07:29
16:31 869
03:54 488
18:35 862
18:03 961
06:55 417
21:46 41
14:00 948
07:17 408
09:48 426
23:32 769
05:53 701
14:20 163
10:06 883
6 00:41
09:55 36
08:56 465
17:26 583
06:26 601
18:35 852
12:34 691
11 07:30
22:14 239
21:36 86
08:53 991
17:26 633
10:23 832
05:08 291
00:26 120
13:37 716
21:05 710
22:27 949
08:14 990
3 03:39
02:39 804
07:57 779
10:35 974
15 05:14
20:29 474
08:46 825
07:08 597
00:06 942
09:27 177
00:21 848
08:12 837
09:35 215
12:33 329
19:39 334
21:35 193
10:23 816
20:46 745
16:11 361
03:24 717
13 01:20
16:45 139
00:58 974
13:10 567
10:29 750
03:55 505
02:53 951
04:54 494
13:10 534
05:53 328
04:25 557
17:41 921
05:22 222
17:23 932
3 13:57
14:21 539
22:15 341
22:43 631
13 21:26
17:18 335
14:51 248
05:44 902
20:01 823
22:18 226
22:52 440
07:23 871
16:33 330
10:31 13
02:55 667
16:12 651
15:39 371
19:48 879
9 20:28
04:42 337
23:28 518
15:04 296
01:24 796
22:14 36
10:28 514
20:08 450
00:51 794
11:10 172
11 18:35
22:14 399
05:37 91
09:45 913
23:50 783
15:16 352
07:38 942
18:34 556
17:14 220
20:29 182
14:19 343
05:22 908
12 07:23
09:44 289
11:12 799
13:51 267
09:50 399
17:20 479
05:26 230
20:38 331
01:52 352
16:26 294
22:09 184
10:22 542
10:09 42
10 02:40
03:11 515
12:08 417
00:37 639
06:13 283
17:06 904
00:46 5
01:13 679
10:03 14
19:01 615
04:50 262
17 22:11
03:26 694
11:18 665
20:36 822
12:42 966
08:46 820
22:12 602
21:46 411
06:57 227
04:13 848
04:01 541
07:21 86
06:32 271
22:44 708
03:44 726
14:08 677
07:22 236
22:43 898
16 17:20
18:21 954
12:25 181
19:32 470
05:50 547
02:48 50
23:31 646
22:13 234
15:33 823
13:35 468
00:30 186
13:05 280
14:09 704
09:28 72
17:14 81
09:44 83
14:35 902
16 21:44
08:48 458
20:53 619
20:22 464
05:03 529
11:09 352
19:43 164
20:40 52
03:50 978
22:40 957
17:47 405
02:19 691
23:32 48
08:16 687
23:25 569
07:36 268
04:08 345
2 20:35
21:35 588
16:01 732
20 07:36
18:49 666
06:48 512
12:32 43
19:23 446
18:34 690
14:06 169
09:20 957
12:29 513
18:01 232
15:40 395
08:39 191
20:45 459
16:37 819
00:45 732
17:03 419
22:33 611
20:58 783
13:50 677
06:08 652
04:16 973
14 12:49
07:32 942
05:16 17
20:28 652
19:25 103
08:51 640
15:47 606
19:05 271
07:35 913
13:55 954
00:28 430
17:47 317
08:32 126
01:17 281
06:16 537
16 00:23
04:55 351
20:54 726
22:30 601
12:43 208
15:07 633
13:13 375
20:37 275
18:06 841
17:25 113
16:12 893
07:08 789
10:04 896
21:42 960
08:19 251
05:02 125
07:51 626
20 23:07
00:10 729
18:15 691
20:43 374
22:27 108
16:05 191
04:42 201
10:02 743
15:36 459
04:07 781
02:06 714
02:59 696
20:17 698
07:02 638
06:16 789
05:56 502
09:48 884
08:14 536
05:06 356
17:22 287
16:01 394
3 07:04
23:15 874
02:22 579
09:56 651
16 05:21
02:03 158
04:15 829
00:00 831
20:29 909
15:25 760
12:00 77
05:23 280
19:41 368
11:39 715
11:34 500
12:17 843
18:45 15
14:37 70
16:37 158
20:52 438
14:56 244
11 13:35
18:44 982
15:23 938
13:27 309
16:51 599
02:01 70
03:27 950
08:07 902
19:16 904
20:46 350
08:08 883
00:38 757
18 22:16
17:15 221
07:31 653
03:49 71
23:40 927
21:40 427
07:36 483
14:36 854
05:48 688
01:36 574
06:33 882
15:18 706
14:18 546
09:57 244
18:36 506
22:09 402
21:57 470
05:59 458
02:56 300
9 09:35
21:08 489
11:23 754
13:13 824
17:15 918
19:45 867
04:47 551
06:44 251
12:29 872
10:56 71
10 08:49
08:17 64
20:05 163
07:34 251
00:15 741
18:58 633
13:07 925
21:29 42
02:42 781
18:56 372
10:17 814
20 13:05
13:10 925
13:17 180
19:54 64
16:40 132
14:29 889
11:14 425
21:52 212
08:14 708
23:24 901
06:16 443
03:57 513
17:58 864
05:10 319
17:54 487
15:57 232
20:48 488
22:21 813
19:57 150
04:32 189
02:55 115
19 22:54
12:52 604
12:49 270
21:30 732
11:45 312
11:33 936
01:32 333
23:15 668
00:23 929
14:37 1
03:48 567
22:12 858
19:52 124
06:50 743
07:29 843
22:28 314
05:53 962
09:21 307
11:21 749
02:03 186
12 07:30
11:17 415
19:28 891
17:34 572
05:21 255
14:55 862
01:48 571
20:14 194
10:25 882
23:39 204
06:51 896
12:06 639
23:26 347
16 11:17
04:20 651
07:10 291
07:12 525
04:48 377
06:23 515
21:10 246
16:40 193
10:33 994
09:00 122
16:55 776
13:00 5
16:35 344
06:18 416
04:46 563
13:20 90
11:22 56
1 06:01
17:41 71
9 18:34
17:35 782
05:28 222
17:08 935
03:06 472
06:11 784
21:36 375
11:39 507
15:59 383
16:20 590
11 04:39
21:33 566
19:14 732
09:55 225
22:39 716
10:45 39
09:54 573
08:29 521
05:24 130
16:21 283
13:51 975
20:48 14
7 23:08
00:32 856
11:47 696
21:01 497
17:02 131
06:10 69
13:39 678
16:24 985
5 05:03
20:25 646
21:43 830
17:35 526
01:03 668
23:12 727
12 09:51
00:55 85
11:37 957
10:53 864
22:57 707
01:29 942
09:55 443
17:28 323
09:05 117
08:09 231
08:32 85
11:08 871
17:19 800
3 09:52
03:43 761
13:01 741
00:10 265
15 03:26
19:04 867
00:00 495
12:37 658
18:12 176
16:33 741
02:35 407
18:18 852
08:47 824
23:35 969
21:01 117
11:49 865
11:01 189
12:41 507
09:48 376
03:16 884
13 06:52
06:53 612
08:53 402
11:04 988
09:13 880
18:40 22
15:40 914
01:04 94
16:18 339
08:45 209
01:37 123
17:59 465
20:36 995
23:27 142
2 12:16
04:58 673
13:38 506
3 07:25
01:40 457
12:00 409
03:29 835
14 10:49
23:23 250
23:38 294
14:11 553
11:03 522
00:56 758
09:59 449
02:28 101
14:29 782
06:00 373
08:53 239
01:45 302
02:44 344
22:38 662
23:41 826
8 21:56
12:54 741
01:25 501
22:39 546
19:13 394
09:45 551
02:58 480
09:28 557
07:43 233
8 22:56
19:57 340
04:26 949
07:03 436
23:14 951
16:49 591
06:35 884
09:05 658
17:50 856
18 01:57
19:33 953
15:52 308
09:00 903
17:56 875
10:59 326
10:40 38
23:50 383
02:23 981
20:56 442
06:13 113
15:44 35
14:04 653
11:53 585
10:58 190
05:36 350
09:26 611
11:49 56
04:08 928
15 16:28
11:10 561
09:41 184
04:11 256
07:47 808
23:37 477
11:46 9
03:20 426
06:59 937
04:28 186
12:34 452
09:09 970
06:18 818
00:34 330
14:34 814
09:33 170
15 01:06
11:40 766
22:26 57
03:22 225
03:51 559
12:48 880
18:18 612
22:07 169
13:01 206
03:11 998
02:17 732
00:57 69
22:35 692
16:02 967
09:10 510
01:34 336
12 04:21
15:50 464
17:19 897
18:46 180
08:17 792
23:53 741
18:40 143
23:36 625
11:09 683
18:39 149
21:22 304
11:37 654
11:34 220
14 20:34
02:16 680
05:39 20
00:37 672
11:37 1
17:52 615
04:23 71
10:48 631
20:35 524
00:27 682
12:40 619
03:11 24
22:16 318
15:44 881
12:12 783
6 17:26
12:13 634
17:23 500
09:19 903
17:36 998
12:48 371
20:27 583
13 18:24
23:33 567
20:34 604
06:11 160
01:27 229
06:09 339
12:22 105
22:51 180
22:56 784
19:40 112
07:04 154
07:55 310
12:52 872
16:14 911
7 15:22
17:26 644
19:26 732
09:16 519
03:31 996
06:42 161
20:02 40
12:37 331
14 13:40
13:54 502
00:12 844
10:29 885
14:52 815
03:42 845
20:33 664
13:15 23
10:59 124
03:27 391
08:13 82
04:42 110
15:06 707
02:44 410
02:46 559
18 02:27
17:26 762
11:52 468
00:06 182
15:14 56
08:10 783
06:38 542
02:46 935
02:36 1
07:26 385
04:36 199
20:29 963
01:28 979
09:17 479
09:56 505
13:56 697
01:30 660
04:24 895
12:50 555
18 21:37
05:14 142
14:38 729
22:03 400
18:28 798
05:02 426
17:55 678
08:20 943
13:52 713
08:53 383
19:50 985
08:31 455
14:14 745
12:24 615
15:47 533
15:20 372
12:25 498
13:57 74
16:26 952
13 14:22
23:09 488
11:10 222
17:16 159
13:04 642
16:56 647
03:51 654
17:55 167
05:56 266
02:25 918
20:29 398
06:08 880
23:31 30
04:36 302
3 05:34
17:25 246
19:41 114
21:26 527
18 07:05
14:38 646
09:02 699
19:48 390
07:48 396
20:08 169
02:02 456
12:56 559
10:19 703
11:41 259
20:10 36
02:00 178
12:13 637
20:45 477
01:20 878
13:08 60
09:34 185
19:34 273
11:56 971
4 00:13
14:08 13
16:50 172
12:55 326
22:51 562
1 08:26
23:37 330
10 23:09
22:10 993
07:49 444
00:13 115
05:31 462
17:35 716
08:47 140
05:01 815
11:21 130
01:12 862
04:42 799
18 20:05
16:08 46
16:20 1000
16:29 205
05:02 80
08:59 112
22:08 8
19:32 175
01:21 560
21:29 534
15:46 973
12:31 147
23:47 720
10:44 621
21:37 556
06:01 696
19:59 366
08:06 129
11:56 435
8 21:20
08:00 619
10:53 757
00:40 850
10:18 323
14:19 19
12:26 964
13:01 676
06:13 972
13 13:09
07:24 633
19:08 659
06:59 907
16:11 112
02:50 586
11:40 912
10:20 171
13:57 167
04:31 218
17:43 879
06:38 709
16:46 242
06:44 833
11 01:10
13:43 272
07:06 151
01:44 129
00:46 592
01:02 595
03:31 960
10:53 428
17:21 685
00:39 658
11:41 793
09:07 320
AC output:

Code: Select all

Case 1: 595
Case 2: 562
Case 3: 402
Case 4: 644
Case 5: 418
Case 6: 381
Case 7: 494
Case 8: 176
Case 9: 223
Case 10: 482
Case 11: 643
Case 12: 350
Case 13: 604
Case 14: 817
Case 15: 633
Case 16: 396
Case 17: 219
Case 18: 186
Case 19: 299
Case 20: 316
Case 21: 500
Case 22: 369
Case 23: 169
Case 24: 563
Case 25: 658
Case 26: 495
Case 27: 1079
Case 28: 819
Case 29: 520
Case 30: 285
Case 31: 515
Case 32: 469
Case 33: 640
Case 34: 400
Case 35: 500
Case 36: 565
Case 37: 590
Case 38: 932
Case 39: 1037
Case 40: 430
Case 41: 464
Case 42: 563
Case 43: 278
Case 44: 142
Case 45: 296
Case 46: 208
Case 47: 392
Case 48: 603
Case 49: 527
Case 50: 156
Case 51: 648
Case 52: 254
Case 53: 499
Case 54: 404
Case 55: 536
Case 56: 823
Case 57: 282
Case 58: 781
Case 59: 404
Case 60: 152
Case 61: 802
Case 62: 192
Case 63: 375
Case 64: 642
Case 65: 61
Case 66: 771
Case 67: 557
Case 68: 175
Case 69: 491
Case 70: 1278
Case 71: 447
Case 72: 930
Case 73: 644
Case 74: 322
Case 75: 588
Case 76: 684
Case 77: 536
Case 78: 589
Case 79: 923
Case 80: 369
Case 81: 816
Case 82: 361
Case 83: 653
Case 84: 420
Case 85: 764
Case 86: 188
Case 87: 320
Case 88: 516
Case 89: 10
Case 90: 426
Case 91: 333
Case 92: 957
Case 93: 334
Case 94: 848
Case 95: 1241
Case 96: 179
Case 97: 131
Case 98: 1038
Case 99: 215
Case 100: 163
Check input and AC output for thousands of problems on uDebug!

shondhi
New poster
Posts: 25
Joined: Tue Oct 02, 2012 5:24 pm
Location: Chittagong
Contact:

Re: 11958 - Coming Home

Post by shondhi » Sat Apr 13, 2013 6:05 pm

Thanks Brian Fry. Got AC!! :)

mahbubcseju
New poster
Posts: 2
Joined: Fri Apr 26, 2013 5:27 pm

uva 11958

Post by mahbubcseju » Fri Apr 26, 2013 7:52 pm

#include<stdio.h>
int main()
{
int c,t,i,j,h1,h2,m1,m2,bus,nt,time,ti,minimal;
while(scanf("%d",&c)!=EOF)
{for(j=1;j<=c;j++){
minimal=1440;

scanf("%d",&bus);
scanf("%d:%d",&h1,&m1);
t=60*h1+m1;
for(i=1; i<=bus; i++)
{
scanf("%d:%d",&h2,&m2);
scanf("%d",&nt);
if(h2<h1){h2=24+h2;}
else if(h1==h2&&m2<m1){h2=h2+24;}
time=h2*60+m2+nt;

ti=time-t;

if(minimal>ti)
{
minimal=ti;
}



}printf("Case %d: %d\n",j,minimal);






}
}





return 0;
}
where is my wrong in this code

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: uva 11958

Post by brianfry713 » Sat Apr 27, 2013 2:02 am

Input:

Code: Select all

100
14 05:43
23:22 586
14:53 643
13:11 696
10:00 215
19:42 715
02:18 356
08:58 507
19:25 684
03:33 681
23:58 900
22:01 346
16:04 20
16:57 274
22:11 838
9 18:30
21:45 534
13:21 808
20:04 92
08:59 428
12:58 885
05:32 662
12:52 139
16:00 877
15:39 393
12 19:23
05:20 694
13:25 950
19:21 302
19:10 437
03:34 585
22:19 465
10:55 971
14:59 126
07:42 246
23:05 235
10:58 500
18:15 394
4 23:11
21:54 39
14:57 154
09:11 741
13:37 835
11 19:44
07:14 879
11:26 12
02:52 47
10:35 280
00:30 446
15:43 709
16:21 806
07:59 313
17:16 891
10:58 369
18:05 313
5 04:41
00:31 716
15:09 420
09:37 941
18:08 891
13:52 395
14 23:11
17:52 672
19:06 568
16:04 547
07:29 543
01:09 102
15:04 796
20:37 15
23:35 880
22:52 115
07:26 569
10:19 288
14:54 490
05:46 628
05:54 272
6 23:33
21:50 472
02:50 736
08:05 670
23:28 985
23:03 174
22:49 242
14 16:59
15:37 436
22:42 934
01:27 70
02:16 562
08:10 518
19:55 880
05:22 226
12:33 644
05:35 553
02:29 245
05:12 669
06:58 60
14:52 273
12:18 408
6 14:50
07:01 992
07:31 333
15:19 94
22:53 913
15:23 697
07:52 317
10 22:24
12:28 290
23:05 41
19:22 815
01:17 37
02:41 68
05:08 201
10:35 682
15:50 61
16:49 801
14:10 646
12 23:20
11:22 903
06:33 638
16:34 944
19:04 7
05:26 436
02:12 183
17:43 182
10:36 989
20:54 340
12:37 919
08:37 377
22:55 122
14 03:45
14:58 156
08:15 459
11:42 181
04:03 234
04:49 316
17:37 744
16:25 296
15:34 956
04:00 763
02:05 221
03:08 680
17:40 585
00:43 139
20:52 24
1 08:08
07:37 223
14 17:03
13:48 872
17:08 791
09:39 378
21:54 959
15:51 539
20:04 554
00:28 259
02:40 456
22:24 203
00:17 151
03:58 217
08:56 160
13:57 721
15:42 768
19 21:03
09:10 562
03:34 328
02:16 303
00:07 492
00:43 948
09:14 38
10:14 28
00:51 60
13:46 357
13:24 286
08:01 124
07:29 320
06:31 970
18:55 373
10:11 135
12:24 930
12:15 627
12:51 17
05:53 860
6 22:42
03:06 625
18:05 640
12:15 107
10:34 484
19:00 972
15:52 413
18 08:06
01:44 727
20:30 480
01:07 742
23:46 661
07:21 799
11:33 484
15:23 709
02:58 274
04:01 200
07:30 142
13:55 821
23:43 675
17:48 371
02:36 888
16:07 728
04:34 522
19:37 239
16:55 323
14 12:55
15:31 854
02:13 546
01:00 312
18:21 392
10:23 590
21:04 840
13:12 472
14:11 974
02:27 139
20:52 630
03:20 238
16:50 680
04:15 681
03:49 102
16 23:11
14:49 329
01:14 285
02:29 36
16:47 601
14:08 253
16:15 573
14:48 703
12:32 463
03:12 528
03:19 649
06:37 714
14:06 760
13:20 688
00:49 46
05:19 540
19:48 386
10 18:03
17:46 858
04:37 722
20:08 731
12:43 856
08:33 554
23:34 990
07:50 825
19:48 508
06:11 50
21:21 1000
17 02:52
04:47 599
19:07 723
22:31 400
02:32 651
00:23 69
11:43 765
11:54 956
23:12 275
14:46 297
08:14 104
16:18 468
17:54 606
15:20 859
00:22 939
18:50 605
03:06 236
02:57 879
6 12:37
23:51 964
11:03 537
17:07 723
22:24 241
22:56 824
22:24 15
11 07:42
06:26 878
12:16 743
13:33 782
06:44 737
21:47 297
18:32 879
02:54 80
16:53 314
02:43 980
02:14 418
09:24 699
6 00:33
15:17 415
18:59 81
15:48 261
00:59 60
11:49 325
11:06 973
20 08:18
00:03 139
15:48 201
17:13 43
14:09 856
13:27 779
20:42 778
06:58 388
13:14 22
07:01 613
09:53 602
19:21 384
11:48 330
15:33 317
20:52 88
22:17 115
11:25 445
09:47 444
02:13 993
01:12 790
05:37 529
11 13:48
18:12 882
14:44 613
16:16 349
14:50 506
20:17 855
00:19 966
18:09 590
15:14 52
17:56 326
00:58 412
04:41 759
9 19:55
10:03 644
04:58 771
07:46 108
23:02 433
03:36 823
15:43 301
04:24 170
10:24 31
05:56 960
1 17:33
04:15 392
12 00:26
05:11 439
04:47 699
18:30 145
09:25 460
03:53 124
13:15 975
18:36 964
19:09 901
08:37 779
01:00 948
19:09 913
12:13 217
3 23:25
01:57 333
08:52 788
15:06 896
7 04:20
10:47 379
23:24 461
00:37 960
00:08 957
00:44 939
07:19 650
08:44 602
12 04:10
11:55 921
18:14 870
14:36 903
23:52 993
09:16 222
00:52 203
16:45 66
13:40 509
18:01 366
00:04 99
03:43 831
07:13 226
13 20:48
00:07 489
16:09 725
01:01 594
06:53 319
04:42 498
21:53 266
03:21 958
13:00 430
02:48 889
02:12 404
06:00 736
14:28 653
02:57 806
19 07:26
00:24 696
10:09 21
01:36 800
00:05 53
18:32 776
17:02 145
05:20 445
12:10 667
16:48 723
01:58 507
15:34 84
07:00 344
13:17 654
00:29 801
19:03 927
23:21 638
02:02 874
06:06 432
17:50 108
7 15:10
18:58 916
02:41 864
11:10 986
09:46 860
09:22 294
12:45 179
22:59 919
12 21:32
11:15 508
06:41 196
16:51 462
17:09 382
10:44 977
20:58 356
16:55 954
16:59 235
12:21 346
19:05 733
15:28 751
18:02 433
12 07:09
19:16 465
00:06 933
15:50 724
17:35 329
09:39 986
14:07 710
11:02 687
05:22 38
14:04 564
20:07 759
09:38 539
07:54 768
6 22:11
02:31 457
17:53 762
12:47 905
17:22 493
18:19 85
20:01 880
9 09:53
19:10 576
10:21 322
03:27 667
02:09 656
01:38 934
06:31 425
07:24 475
23:58 508
12:06 963
11 14:13
03:09 414
02:07 161
00:26 827
20:05 134
08:22 103
20:56 410
08:04 73
23:39 471
13:03 640
00:05 526
05:08 886
10 03:47
14:55 412
10:04 156
19:16 949
10:24 551
21:01 557
03:28 150
16:57 35
16:45 855
06:31 988
21:40 82
13 18:20
02:44 408
04:07 31
09:57 193
06:46 390
11:50 406
07:58 749
22:26 71
19:24 646
17:10 577
09:34 25
21:12 508
01:45 158
21:42 150
3 04:16
11:27 705
21:50 500
07:12 923
4 00:39
22:41 798
21:14 777
22:00 534
19:01 918
12 23:39
21:57 959
17:00 103
07:13 460
07:33 374
10:28 770
06:31 254
23:28 981
23:15 720
08:34 570
05:18 871
09:39 887
08:00 7
4 19:56
11:18 534
12:33 758
13:27 339
07:02 855
17 18:48
16:14 267
14:23 521
03:20 930
05:41 7
00:36 840
08:11 617
05:24 570
10:37 886
23:25 51
16:01 225
20:09 250
22:52 735
23:43 553
02:17 45
10:41 315
04:01 513
17:34 321
4 08:09
08:31 783
16:39 361
17:35 345
13:38 613
17 01:04
03:51 639
08:17 982
12:58 774
04:55 859
12:59 375
10:11 971
12:51 572
16:45 815
21:58 968
18:46 932
02:29 947
04:49 709
14:06 750
02:46 376
03:59 156
13:13 976
23:01 577
1 21:49
20:54 429
4 04:25
18:47 134
13:55 575
06:57 371
08:39 965
15 23:11
03:48 610
16:35 644
20:27 590
09:52 795
04:35 178
21:33 538
07:39 131
11:09 321
21:53 880
10:48 667
13:43 748
18:51 91
04:11 962
19:12 171
13:52 69
1 17:56
09:25 290
19 12:36
04:14 723
17:12 887
22:05 367
15:15 451
11:43 403
19:31 480
03:32 418
06:32 884
15:10 9
18:20 751
23:00 479
21:41 158
19:43 227
20:10 985
09:14 75
14:21 469
11:17 579
12:35 656
07:42 236
16 05:09
12:28 314
06:01 392
05:36 354
13:56 636
00:46 330
19:24 398
09:47 9
00:39 614
03:59 419
04:46 785
13:46 980
10:57 416
20:30 671
10:23 801
19:59 567
17:55 753
10 20:58
14:32 240
15:11 533
18:31 725
18:08 949
14:46 682
19:07 83
04:45 380
13:52 246
17:26 138
04:47 835
12 14:11
09:05 171
14:03 703
21:25 31
19:31 779
14:38 28
19:58 515
23:27 492
19:00 362
01:53 142
04:36 221
20:57 213
11:47 227
2 00:39
00:20 653
22:38 149
15 14:30
00:53 7
03:12 809
19:30 982
03:34 745
01:42 338
20:57 985
14:59 98
17:47 939
11:01 257
07:56 756
01:00 504
15:07 440
17:43 391
04:34 501
03:40 135
16 04:34
06:43 498
05:52 652
17:04 11
07:47 988
03:53 94
04:48 513
22:33 917
10:01 828
13:40 466
10:27 354
20:01 100
10:06 61
11:39 198
05:26 40
12:29 796
23:26 471
10 00:49
23:23 749
19:12 76
07:38 957
15:46 683
19:12 44
11:51 979
03:37 124
02:25 545
19:52 436
11:21 928
18 12:18
11:07 763
02:38 433
23:42 573
18:53 372
15:04 790
15:11 219
18:53 338
19:12 240
13:40 129
16:49 921
22:48 824
20:54 922
20:42 641
11:04 81
02:59 304
12:14 197
08:01 802
00:48 602
18 13:20
15:10 772
13:36 145
19:33 266
08:21 473
18:56 448
14:14 235
13:15 194
20:27 758
20:15 161
08:24 531
21:15 104
06:45 671
08:16 682
21:04 570
03:59 290
06:29 522
11:54 437
19:54 564
1 02:28
05:03 469
5 00:00
08:34 436
13:19 298
03:40 197
07:11 773
11:57 797
14 09:56
15:08 371
03:49 300
23:22 964
08:06 812
20:55 927
09:24 142
18:16 726
08:27 840
13:02 243
23:07 551
20:58 266
15:54 838
12:17 426
05:17 251
14 05:09
04:02 600
10:25 474
12:45 683
14:47 135
13:58 734
13:58 607
01:49 627
03:02 105
15:31 203
13:56 225
15:53 990
01:39 793
15:40 832
16:58 880
20 15:22
13:32 33
10:45 774
17:00 633
10:31 885
20:25 411
03:28 449
01:05 831
00:24 661
01:52 780
00:31 740
22:12 782
23:11 171
09:56 748
01:54 625
04:06 746
15:58 148
00:15 122
08:32 832
04:33 959
10:57 328
4 00:28
16:35 294
06:36 503
13:49 408
04:21 210
8 04:02
15:28 627
19:28 21
20:48 533
16:34 421
00:09 419
08:05 250
03:24 378
10:41 435
17 09:53
09:45 781
15:16 619
21:23 652
03:23 919
18:08 200
19:08 234
11:28 804
03:19 769
18:21 877
03:30 134
08:43 596
10:58 100
17:24 460
20:39 818
23:02 511
13:37 559
21:00 946
15 19:23
23:02 260
21:05 409
05:53 72
14:52 387
15:13 49
04:33 390
08:24 633
20:38 889
16:51 577
04:25 17
03:28 209
07:49 658
02:59 669
11:49 402
19:21 787
12 13:45
19:25 214
00:21 686
11:01 264
22:53 372
04:00 158
01:43 190
06:25 911
21:41 605
16:36 755
16:28 820
17:39 617
19:19 37
3 06:50
13:52 608
16:01 428
12:42 981
10 00:20
17:26 650
06:58 918
05:51 905
08:12 1
01:35 150
02:38 622
21:55 991
12:59 275
04:03 375
11:12 949
16 21:25
09:44 300
15:17 958
05:53 179
22:06 869
02:01 403
05:38 356
13:50 481
13:22 625
08:57 599
19:53 382
20:50 581
11:09 950
18:26 689
01:04 104
11:30 235
12:36 340
16 17:27
14:58 485
21:06 624
08:05 186
16:29 132
05:17 69
18:11 592
17:16 391
03:15 307
01:31 963
18:59 347
09:37 117
02:22 337
17:10 957
01:19 16
03:24 509
06:34 701
12 08:48
20:59 969
00:04 696
07:46 310
00:47 673
23:38 26
12:59 733
19:53 792
16:00 475
13:31 422
22:42 12
10:31 350
22:43 51
15 18:56
16:06 519
04:21 559
07:14 508
08:57 863
16:53 445
12:19 323
06:17 469
01:55 274
06:22 736
16:16 817
17:12 863
01:05 683
19:00 613
00:08 299
11:40 450
3 04:01
00:14 59
16:19 680
20:38 403
19 18:35
19:23 316
15:16 798
04:15 157
15:28 437
11:31 428
17:33 605
06:57 770
16:17 246
10:13 73
17:04 993
21:35 79
13:30 541
14:02 938
15:41 466
16:09 299
09:18 572
22:37 988
13:05 324
16:31 238
14 05:55
21:30 508
16:31 234
07:01 13
22:16 79
21:08 801
07:09 937
10:43 751
06:48 683
04:53 411
23:26 30
10:27 155
00:19 792
01:03 737
17:53 838
19 07:49
04:50 173
20:53 821
06:23 863
01:31 234
15:30 389
19:08 631
16:09 417
21:46 290
06:03 187
12:33 954
13:25 507
12:58 801
21:32 512
23:21 273
02:40 14
04:47 578
17:04 163
17:53 314
13:15 423
3 15:38
06:21 866
08:21 626
20:46 602
16 14:30
13:20 111
06:48 776
20:17 6
06:59 285
07:40 349
00:22 415
06:16 635
13:04 872
03:40 947
20:35 721
03:05 118
06:47 530
08:35 274
19:54 79
18:13 235
05:29 309
5 11:04
23:05 507
16:32 318
15:08 511
12:15 667
09:25 180
4 10:29
11:21 871
17:31 523
20:37 83
20:33 740
14 20:10
18:52 948
03:07 107
12:59 3
02:49 820
12:32 950
05:11 400
20:53 837
16:01 609
18:57 822
00:42 420
14:36 345
01:56 855
04:32 667
18:15 282
11 03:22
04:56 164
11:08 94
18:48 326
05:11 479
06:39 115
03:17 434
04:22 752
17:02 579
22:25 964
11:55 705
13:00 814
12 15:34
01:01 578
01:59 219
18:17 444
13:44 301
05:04 120
13:34 626
10:56 894
21:59 362
04:25 360
18:08 597
21:09 982
04:14 431
11 08:29
07:02 863
01:55 299
18:49 313
06:23 571
06:36 355
06:28 275
18:39 806
14:16 421
11:08 449
23:18 366
16:17 289
14 18:06
06:05 346
18:11 810
01:05 386
08:28 472
12:34 260
20:52 531
10:31 552
14:22 232
18:50 325
05:15 512
03:58 223
02:08 775
04:57 751
06:10 512
2 10:59
19:59 138
05:45 962
8 23:38
11:33 50
16:50 16
08:05 897
04:59 4
04:03 601
13:38 351
22:19 220
01:31 703
14 12:20
13:36 602
15:47 142
11:28 203
03:52 124
21:12 634
19:32 539
07:57 537
08:47 790
04:37 937
15:10 127
03:59 986
14:26 362
03:06 962
06:13 296
11 11:32
18:54 616
10:17 816
15:06 392
08:38 452
00:54 824
13:13 160
21:28 89
13:55 663
13:17 277
13:47 518
10:18 699
20 04:42
17:59 418
23:08 597
10:32 972
08:49 142
05:35 710
08:28 197
22:58 117
01:47 284
15:01 713
03:12 561
13:18 747
05:57 749
00:48 503
04:08 138
22:41 19
12:53 508
01:51 876
03:32 108
21:51 794
08:35 549
9 00:50
11:58 174
02:14 889
05:34 535
02:21 654
14:37 955
07:27 479
09:58 506
03:59 932
23:48 75
16 16:29
09:15 341
00:45 858
04:18 880
19:45 240
04:15 649
22:34 682
07:24 456
01:39 257
03:06 487
07:21 707
12:10 43
07:47 555
16:43 434
12:06 510
00:38 802
10:12 506
AC output:

Code: Select all

Case 1: 472
Case 2: 186
Case 3: 457
Case 4: 1100
Case 5: 475
Case 6: 946
Case 7: 220
Case 8: 933
Case 9: 578
Case 10: 123
Case 11: 82
Case 12: 355
Case 13: 252
Case 14: 1632
Case 15: 524
Case 16: 288
Case 17: 889
Case 18: 691
Case 19: 489
Case 20: 144
Case 21: 613
Case 22: 250
Case 23: 602
Case 24: 801
Case 25: 86
Case 26: 318
Case 27: 138
Case 28: 620
Case 29: 1034
Case 30: 331
Case 31: 485
Case 32: 766
Case 33: 409
Case 34: 331
Case 35: 184
Case 36: 1144
Case 37: 745
Case 38: 688
Case 39: 717
Case 40: 350
Case 41: 486
Case 42: 533
Case 43: 317
Case 44: 1099
Case 45: 1815
Case 46: 508
Case 47: 1390
Case 48: 328
Case 49: 805
Case 50: 331
Case 51: 1814
Case 52: 523
Case 53: 502
Case 54: 1219
Case 55: 163
Case 56: 287
Case 57: 847
Case 58: 55
Case 59: 1468
Case 60: 127
Case 61: 92
Case 62: 292
Case 63: 211
Case 64: 161
Case 65: 624
Case 66: 417
Case 67: 429
Case 68: 713
Case 69: 184
Case 70: 443
Case 71: 493
Case 72: 165
Case 73: 479
Case 74: 371
Case 75: 979
Case 76: 225
Case 77: 323
Case 78: 439
Case 79: 453
Case 80: 611
Case 81: 1272
Case 82: 259
Case 83: 79
Case 84: 718
Case 85: 910
Case 86: 353
Case 87: 646
Case 88: 691
Case 89: 524
Case 90: 258
Case 91: 607
Case 92: 608
Case 93: 369
Case 94: 678
Case 95: 325
Case 96: 297
Case 97: 261
Case 98: 389
Case 99: 745
Case 100: 436
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 119 (11900-11999)”