I tried multiple times and eventually got 100. The key is that since score is based on edit distance, I tried changing the minimum number of ints to longs so that the code would not overflow. I ended up having to only change int N to long N in the function prototype, and Java’s implicit typecasting took care of the rest.
The key idea is that an acyclic graph is essentially a forest (i.e.) a bunch of trees. Each tree with x nodes has x-1 edges. So the final number of edges required is
number of vertices - number of trees in final graph
The number of trees in the final graph is equal to the number of connected components in the initial graph. Use DSU to count them.
kk got it i changed all int to long
I think it’s not bad. Have no idea about the score distribution/ranklist though.
i only count the no of back edges and got 100 pts
bool vis[MAX];
void dfs(lli src)
{
vis[src]=1;
cnt+=1;
for(auto xt : adj[src])
{
if(!vis[xt])
{
dfs(xt);
}
}
}
int main(){
fastio
lli t=1;
//cin>>t;
while(t--) {
lli n,m,k;
cin>>n>>m;
loop(i,m)
{
lli x,y;
cin>>x>>y;
adj[x].pb(y);
adj[y].pb(x);
}
FOR(i,1,n+1)
{
if(!vis[i])
{
cnt=0;
dfs(i);
m-=(cnt-1);
}
}
print(m);
}
return 0;
}
cnt is the size of conneted component , now after each call subtract cnt-1 from m , bcz for a tree of n nodes there must be n-1 edges .
At 380 points,do I have any chance of getting a call? I did 2 coding and 2 debugging questions.
My score was 580, no call yet.
Wow really cool, no chance for me then.
What was your score ??
Anyone got called???how many of you got 700 out of 700?
Mine 300 only 
Where did they invite you? Did they mail you?
I got 700 as well
U have to said this earlier your name should be in above meme. 
I solved Decomposition problem using Segment Tree with Max Query but I got only 52 points due to which i scored 352 only!!!..here’s the code
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define int long long
#define ll long long
#define vi vector<int>
#define pb push_back
#define endl "\n"
#define mod 1000000007
int n, q, t;
ll quality[100005], quantity[100005];
ll tree[500005];
map<ll, int> mp;
void buildTree(int v, int l, int r)
{
if(l == r)
{
tree[v] = quality[l-1];
}
else
{
int mid = (l + r)/2;
buildTree(2 * v, l, min(mid, r));
buildTree(2 * v + 1, max(mid + 1, l), r);
tree[v] = max(tree[2 * v], tree[2*v + 1]);
}
}
ll get(int v, int l, int r, int start, int end)
{
if ((l > r) || (l > end) || (r < start))
return 0;
if (l == start && r == end)
return tree[v];
int mid = (l + r) / 2;
return max(get(2 * v, l, mid, start, min(mid, end)), get(2 * v + 1, mid + 1, r, max(start, mid + 1), end));
}
int32_t main()
{
IOS
cin>>t;
while(t--)
{
cin>>n>>q;
for(int i = 0; i<n; i++)
{
cin>>quality[i];
mp.insert({quality[i], i});
}
for(int i = 0; i<n; i++)
{
cin>>quantity[i];
}
buildTree(1, 1, n);
while(q--)
{
int type;
cin>>type;
if(type == 1)
{
int l, r;
ll addQ;
cin>>l>>r>>addQ;
ll maxQuality = get(1, 1, n, l, r);
int idx = mp[maxQuality];
quantity[idx] += addQ;
}
else
{
int v, idx;
ll takeQ, thrus;
cin>>v>>idx>>takeQ>>thrus;
int l = max(idx-v, 1);
int r = min(idx+v, n);
ll maxQuality = get(1, 1, n, l, r);
int maxId = mp[maxQuality];
if( (quantity[maxId] < takeQ) || (maxQuality < thrus))
{
cout<<"No purchase"<<endl;
}
else
{
int p = maxId + 1;
cout<<p<<endl;
quantity[maxId] -= takeQ;
}
}
}
}
}
// code by mayank chaudhary
// chaudhary_19
can anyone please help me why I was getting wrong answer on 2 testcases…
(according to me it is some int-long problem but not sure)
and Did anyone get any call from them especially who have scored > 500 
The implemented algorithm was Kosaraju though.
achcha thnax
Did anybody got any mail for further rounds?
