You are not logged in. Please login at www.codechef.com to post your questions!

×

Why giving wrong answer ? Max and min problem

The program seems to be correct but gives wrong answer-

The link to solution is- maxandmin

asked 04 Jan '15, 17:57

vedant2080's gravatar image

0★vedant2080
914
accept rate: 0%

1

Please provide link to question.

(04 Jan '15, 18:43) vinayawsm4★

Come on, how should we know why your program is incorrect when you are not able to share what is your goal? I took a quick look at you link, but it is not clear to me what are you doing. Please read this and edit your question properly.

(05 Jan '15, 18:37) betlista ♦♦3★

I am studying from nptel.ac.in . It is website maintained by govt of India and contains courses from IIT's. I am on course of Programming and Data Structures. In the course it is being explained how to reduce time by making program efficient. The goal of this lecture is to find out the maximum and minimum of given N numbers. That is on first line a number N will be taken as input and than N lines containing integers. Out of those N numbers you have to find the maximum and minimum among them. The code is giving wrong answer on my computer but giving correct output on the proffesor's computer.

(06 Jan '15, 12:26) vedant20800★

The link to lecture is- nptel.ac.in/courses/106105085/6 The output produced on my computer is any garbage value. You can have a look at it if you want.

Help will be really appericiated.

(06 Jan '15, 12:27) vedant20800★

Do not print any messages like "Give N" .You should only print the output of the program.

Please provide the link of the question if you still face any difficulty.

Happy Coding!!!

link

answered 04 Jan '15, 19:40

the65bit's gravatar image

4★the65bit
1.1k101328
accept rate: 13%

I have written the question in above comment. After removing , "Give N" again it produces any garbage value.

(05 Jan '15, 18:17) vedant20800★

Please provide link to question where you are trying to submit the solution.

(05 Jan '15, 18:35) the65bit4★

I am studying from nptel.ac.in . It is website maintained by govt of India and contains courses from IIT's. I am on course of Programming and Data Structures. In the course it is being explained how to reduce time by making program efficient. The goal of this lecture is to find out the maximum and minimum of given N numbers. That is on first line a number N will be taken as input and than N lines containing integers. Out of those N numbers you have to find the maximum and minimum among them. The code is giving wrong answer on my computer but giving correct output on the proffesor's computer.

(06 Jan '15, 12:23) vedant20800★

The link to lecture is- nptel.ac.in/courses/106105085/6

You can have a look at it if you want.

Help will be really appericiated.

(06 Jan '15, 12:25) vedant20800★

As @the65bit says, it is like Sgt. Joe Friday says in Dragnet ... "Only the facts, Ma'am."

The Online Judge compares your output to the "correct answer output" and if there is any non-whitespace difference, then it is wrong.

Any debug or testing output must be removed prior to the Submit.

link

answered 05 Jan '15, 02:29

xyzzy529's gravatar image

2★xyzzy529
1113
accept rate: 0%

I am not testing it on any online judge. I am testing it on my own computers and answer produced are not even given as input ie any garbage value is returned as output. You may try it on your compiler.

Please help!!

(05 Jan '15, 18:19) vedant20800★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×26
×11

question asked: 04 Jan '15, 17:57

question was seen: 553 times

last updated: 20 Mar '18, 14:44