INOI 2020 Discussion

@tush_chen i guess you took an element again and again and ran same DFS many times as when it was included in an DFS, you didn’t do something to make sure that an element is not taken twice like by changing its colour. Therefore it ran good in 1st subtask as there was only 1 department but failed in multiple one. If you didn’t do this mistake, please send me an approximate code what you wrote, I’ll try my best to see why it’s giving TLE. Or maybe you used ‘endl’ instead of “\n”.

@kshitij_789 Even finished 1st question and the 1st and 2nd subtask of 2nd question within 1 hour. But i wasn’t able to figure out the 3rd subtask of 2nd question. Such a fool i am.

Same lol :frowning:

It happens with both of us many a times, i mean coincidence

BTW, I used 1 DFS to determine the the number of departments and people in each department and 1 DFS to find strength of each department. Node is automatically determined by the number of members in each department. I hope it helps. @tush_chen @shlok_1933

1 Like

No that’s exactly what I used, just 1 DFS call to figure out the root node and the type of team it would form. Then, another DFS call to figure out the strength of the team.

Also, what you suggested wouldn’t have happened because my first DFS call ran using a Boolean visited array, so the number of DFS calls would only be equal to the number of components in the graph.

My second DFS call ran by passing a node and it’s parent as arguments to a function.

Well, @anon95832944, I don’t remember my INOI account credentials so when the problems are uploaded onto INOI prac, I’ll solve it the exact same way and send the code here.

@kshitij_789, as I said before, I spent nearly an hour optimizing my code, it’s not possible that I would have left out redundant array declarations.

Anyways, when the problems come out on codechef, I’ll send the code here. It’ll be interesting to find out the reason for this anomalous behavior.

1 Like

I feel you man, sometimes we can try do everything right and stuff still goes wrong :joy:

Some people in my center were also talking about how they implemented 2 DFS followed by 1 BFS and that code got a complete AC, so I was and still am equally as stupefied as you are.

I took care of that, which is why I got WA, no TLE errors, it is so weird I couldn’t find any error in my code at all, and if that had worked, could’ve easily attempted other questions :frowning:

I used the exact sams node logic, and that is why my code ran on many cases, could it be that it was a memory issue and the system said (WA), isn’t there an error with a different name for a memory issue? Wrong answer is pretty misleading…

Bro, code is never wrong, neither is compiler. Check it again once you have it, you’ll get the error.

I used the same logic, i was just passing pointers to the function, i used Fast I/O, so that wasn’t even the problem, my code first TLEd in only 2 and then submitted it again and got TLE in 4. I tried to remove one bfs for the finding the root by using something similar to disjoint set, but I already wasted a lot of time so I messed it up.

1 Like

I used the same logic and got TLEs in 4 out of 9 subtests of question 1, subtask 2! Is there any way to access my code now? (I have the credentials but codechef says the account has been deleted)

I know, you’re not alone. I initially wasn’t planning on bringing this up and making the first post on this thread because I thought it was just me but now that there are actually some other folks who are facing the same issue, I’m actually intrigued now.

How could it be possible that the code takes fluctuating time on a judge ?

1 Like

It depends on which computer of server you code executes and on how many processes are being run on that computer of server. But the difference is negligible for an optimised code.

Same here

TLE on 4 out of 9 subtasks :frowning:

What do you people mean by TLE ?. When you submitted in the contest, the status showed TLE or are you running tests on your computers and taking time ?

When I submitted in the contest, the status was TLE

You seriously did that ? :joy:

My system got hanged just after opening the file and had to restart it

1 Like

No, of course, that it in itself is common sense. I’m talking about how the test cases could have been so strict that even though there were several algorithms submitted, it would only choose to accept a certain DFS code and say, not one with a little higher constant factor. Ideally, as long as the logic is same, the code should AC because hey, we’re all doing the same stuff - declare arrays, performs calculations, etc.

@sudheerays123, that’s literally goes to show how many times I double checked the program :joy:

1 Like

Did you clear the adjacency list at the end of each test case.

The test cases gave TLE rather than RE/WA if you did not clear it.
I did not clear it on the first try, got TLE thought that the tests were pathological and did not allow recursion, started writing bfs code, then realized that I did not clear the adjacency list.

2 Likes