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

×

The Lead Game - Wrong Answer Help

0
1

This is for the problem "Lead Game".

I'm sure my error is a sneaky testcase, a situation I don't expect. Can someone tell me what is wrong with my code? And also, if there is any way to improve it? Thanks. This is python BTW.

highScore = 0
winner = 0
lead = 0
n = int(input())
for x in range(n):
    t1,t2 = list(map(int,input("").split()))
    if t1 > t2:
        lead = t1-t2
        if lead > highScore:
            highScore = lead
            winner = 1
    elif t2 > t1:
        lead = t2-t1
        if lead > highScore:
            highScore = lead
            winner = 2
print(str(winner) + " " + str(highScore))

asked 30 Dec '17, 00:05

kalesaur's gravatar image

2★kalesaur
363
accept rate: 33%


They are actually talking about lead upto that round ie leadx=totalScore1Roundx-totalScore2Roundx.

link

answered 30 Dec '17, 00:23

vivek_1998299's gravatar image

5★vivek_1998299
9888
accept rate: 21%

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:

×848
×698
×427
×147
×41
×9

question asked: 30 Dec '17, 00:05

question was seen: 198 times

last updated: 30 Dec '17, 00:23