11799 - Horror Dash

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

Moderator: Board moderators

Post Reply
rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

11799 - Horror Dash

Post by rahid »

For the easy problem 11799 - Horror Dash I'm getting runtime error!! Interestingly I'm using gcc/g++ compiler in fedora. My compiler version is 4.4.4 20100503. I have no problem at runtime but I'm getting runtime error. How!!! I tested my code in dev cpp in windows platform. Still no runtime problem was there. Is there any idea what is going wrong? My code is here.

Code: Select all

Removed!!
Last edited by rahid on Thu Jul 22, 2010 11:45 am, edited 1 time in total.

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11799 - Horror Dash (Run Time Error)

Post by sohel »

Why is your array size 51? N can be as big as 100.

rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

Re: 11799 - Horror Dash (Run Time Error)

Post by rahid »

sohel wrote:Why is your array size 51? N can be as big as 100.
ThanX i got my answer. And its accepted.

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11799 - Horror Dash (Run Time Error)

Post by saiful_sust »

Rahid...
If u got ACC hten plz remove ur code.. :)

rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

Re: 11799 - Horror Dash

Post by rahid »

Code has been removed!!

anis_cuet016
New poster
Posts: 15
Joined: Thu Jul 08, 2010 8:28 am

Re: 11799 - Horror Dash

Post by anis_cuet016 »

U dont even need an array .............

Anis

rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

Re: 11799 - Horror Dash

Post by rahid »

anis_cuet016 wrote:U dont even need an array .............

Anis
Hello Anis. What is your algorithm for this problem. Please share.

anis_cuet016
New poster
Posts: 15
Joined: Thu Jul 08, 2010 8:28 am

Re: 11799 - Horror Dash

Post by anis_cuet016 »

hello rahid .....

It is written in the problem statement =>
1 . However, to keep the audience on the edge of their seats, the clown must not run too fast either .......
2. Given the speed of every scary creature, you are to find out the minimum speed that the clown must maintain so as not to get caught even if they keep on running forever ..........
3. You can assume that they are always running in the same direction on the track........
from this three line i thought of finding the max from the the number of students acting as scary creatures(that is from the given N ) .... so find that and output dats it ....... btw what was ur thought ???? .....

hope it helps

Anis

shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

Re: 11799 - Horror Dash

Post by shaon_cse_cu08 »

Yeah and u can find the maximum while inputting ur test cases..... We dont need any of the input but only the max one :P
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... :x

Hussam7102
New poster
Posts: 1
Joined: Fri Nov 07, 2014 4:59 pm

Re: 11799 - Horror Dash

Post by Hussam7102 »

Guys plss identify the compile error....After Submission, uva gives a compile error.
Check my code pls..

Code: Select all

#include<iostream>
using namespace std;

int main(){

	int T, num, greater, i, arr[50], count=0, *p;

	p=arr;

	cin>>T;

	try{

		while(T<=50 && T--){

			cin>>num;
			greater=0;
			count++;

			for(i=0; i<num; i++){

				cin>>*(p+i);

				if(greater<*(p+i)) greater = *(p+i); 

			}


			cout<<"Case "<<count<<": "<<greater<<endl;

		}

	
	}
	catch(runtime_error e){
		throw e;
	}
	
	return 0;

}

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11799 - Horror Dash

Post by lighted »

Click on My Submissions to see reason of CE.

It is because of "runtime_error". Add line

Code: Select all

#include <stdexcept>
By the way you could remove try/catch statements. You don't need them to solve problems. :)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11799 - Horror Dash

Post by lighted »

You'll get RE.
At this event, N (1?N?100) students dressed in the scariest costumes possible start out in a race to catch a poor clown running on the same track
Increase array limit to arr[101].
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

steventhai
New poster
Posts: 5
Joined: Thu May 11, 2017 5:06 pm

Re: 11799 - Horror Dash

Post by steventhai »

Hello all,

I don't know why my code get RTE. It's really weird. Please help:

Code: Select all

import java.util.Scanner;

/**
 * 11799 - Horror Dash
 */
class HorrorDash {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int t = scanner.nextInt();
        int c = 1;
        while(t-- > 0) {
            int n = scanner.nextInt();
            int max = 1;
            for (int i = 0; i < n; i++) {
                int value = scanner.nextInt();
                if (value > max) {
                    max = value;
                }
            }

            System.out.printf("Case %d: %d%n", c++, max);
        }

        scanner.close();
    }
}
Thanks.

steventhai
New poster
Posts: 5
Joined: Thu May 11, 2017 5:06 pm

Re: 11799 - Horror Dash

Post by steventhai »

steventhai wrote:
Thu May 11, 2017 8:37 pm
Hello all,

I don't know why my code get RTE. It's really weird. Please help:

Code: Select all

import java.util.Scanner;

/**
 * 11799 - Horror Dash
 */
class HorrorDash {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int t = scanner.nextInt();
        int c = 1;
        while(t-- > 0) {
            int n = scanner.nextInt();
            int max = 1;
            for (int i = 0; i < n; i++) {
                int value = scanner.nextInt();
                if (value > max) {
                    max = value;
                }
            }

            System.out.printf("Case %d: %d%n", c++, max);
        }

        scanner.close();
    }
}
Thanks.
Nvm. I found the issue. I must use Main for all the class name as directed in Submission Specification.

Post Reply

Return to “Volume 117 (11700-11799)”