Review my solution to Problem: LADDU Contest: LRNDSA01

Problem: https://www.codechef.com/LRNDSA01/problems/LADDU
Solution: https://www.codechef.com/viewsolution/34875867

Code:
import re
T = int(input())
for x in range(T):
activity = []
activities, origin = map(str, input().split())

for i in range(int(activities)):
    score = 0
    activity.append(input())

    for item in activity:
        pattern = re.compile("CONTEST_WON[ \s]\d{1,9}")
        if pattern.match(item):
            _, rank = item.split()
            if int(rank)<=5000 and int(rank)<20:
                score += 300 + 20 - int(rank)
            elif int(rank)<=5000:
                score += 300
        elif item == "TOP_CONTRIBUTOR":
            score += 300
        elif item == "CONTEST_HOSTED":
            score += 50
        else:
            _, severity = item.split()
            
            score += int(severity)

if origin == “INDIAN”:
print(score//200)
else:
print(score//400)

i checked your code it’s correct
https://www.codechef.com/viewsolution/34875949

It still shows Wrong Answer

give the link to your solution.

Solution: https://www.codechef.com/viewsolution/34875956

And, the link that you sent says access denied

I submitted your code and it got accepted the link i have given is your code only.

this link also says '"access denied " use other ide to send the code i…e;geeks for geeks or other ide.

That is weird …

Solution: https://ide.geeksforgeeks.org/2gscVRykLd

the last if else block is outside for loop so make it inside for loop and it will be accepted

Oh! Right. I was always testing for 1 test case. Thank you so much @hackraj

1 Like

happy coding