No I haven't figured it out yet. For checking that, I made an exception in such a way that the code terminates when the answer produced is zero. The code returned terminated and returned NZEC!
No I haven't figured it out yet. For checking that, I made an exception in such a way that the code terminates when the answer produced is zero. The code returned terminated and returned NZEC!
Keshav, I read this problem and I had this idea few months ago. I decided to implement it today. But, I'm getting WA on one single test case! I submitted it by tweaking code a bit and found that it gives WA on a case when the answer produced by my code is 0. It would be great if you could help me.
#include <bits/stdc++.h>using namespace std;typedef vector<int> vi;typedef long long ll;typedef pair<double, double> ii;set<int> adj[1003];int degree[1003];int valid[1003];int N, A, B, M;void eliminate(int u){for(auto c : adj[u]){degree[c]--;adj[c].erase(u);
Oops! I searched for Keshav's repository instead of Kuntal's! Such a careless mistake:)
Edit : Corrected name of Kuntal. Earlier, it was 'Kunatal':p
What do you mean by you use BIT in your solution? ioi-training/BOOKLIST.cpp at master · amzee/ioi-training · GitHub Is this the solution you are talking about?
I know a solution using Segment Trees. Your solution in your repository uses ioi-training/BOOKLIST.cpp at master · amzee/ioi-training · GitHub does not use Binary Indexed Trees. So it would be great if you explain what you meant by saying that understanding of BIT will be useful in solving this problem?
You can use sort() in most of the problems where sorting is the only thing required. But for many problems, you need to modify real sorting algorithms in order to solve them. You don't have to memorize the implementations of these algorithms. You should understand how they work.
I checked your code. Your logic is correct. But your code is causing overflow in subtask 2 and subtask 3. See the modified version of your code here : Solution: 15420996
Happy coding and Cheers....!
Is there any other concepts which might help me understand this solution? I can't really understand the hint 4. It would be great if you could elaborate it a little more. Why is it log(n)?