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

×

COOLING - getting WA

For the COOLING (easy) problem, I have submitted this answer. I am getting correct answers in the test cases provided. Apart from that, I have tried atleast 20 different cases. And nowhere am I getting an incorrect answer. So, why am I getting WA? Is it related to the bubble sort that I have used?

asked 24 Sep '13, 22:04

walterwhite's gravatar image

4★walterwhite
26258
accept rate: 0%

edited 24 Sep '13, 22:09


For input:

1
5
100 55 50 30 20
99 45 40 20 10

your program returns 4.

link

answered 24 Sep '13, 22:13

betlista's gravatar image

3★betlista ♦♦
16.9k49115225
accept rate: 11%

Thanks a lot! I made a silly logical error. Again, thanks!

(24 Sep '13, 22:20) walterwhite4★

Max N is 30 and max T is 30 too, so bubble sort is not a problem, but you should learn how to use sorting.

http://www.cplusplus.com/reference/cstdlib/qsort/

http://www.cplusplus.com/reference/algorithm/sort/

(24 Sep '13, 22:23) betlista ♦♦3★

your solution fails for this test case
1
4
2 5 6 7
2 3 6 7
ans is 3 where as your solution gives 4

link

answered 24 Sep '13, 22:18

abhinav1234's gravatar image

4★abhinav1234
47045
accept rate: 40%

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:

×1,056
×775
×29

question asked: 24 Sep '13, 22:04

question was seen: 983 times

last updated: 24 Sep '13, 22:23