SEAGRP - Editorial

Read the wiki, and Xij = rand(), Xji = - Xij. if i < j and (i, j) is an edge.

What do you mean by “Due to the randomness, we can solve this problem with a high probability” …and also How to find determinant of matrix using gaussian elimination??Please tell.

@herman, if you perform the classic gaussian elimination, and if you put the matrix in Upper Triangular form, then, the determinant is simply the product of its diagonal.

@jaggi1234 & @ddhruvkr, i’m not sure if your assumption is correct but I’m pretty sure that it’ll fail in this case , Refer to the image and I’m sorry for the bad image :stuck_out_tongue:

alt text

Your Algo will remove the edge circled in blue , which disconnects the graph and it’ll result in a ‘NO’, but the answer is ‘YES’ !
If this case was included you both should’ve got WA :stuck_out_tongue: be glad you got AC :slight_smile: Cheers !!

2 Likes

@m_a_y_a, I’ve followed an algorithm similar to yours, except that when i encounter a cycle i do the following :

–> Check if the cycle has an articulation point,

–> If yes, then retain only the edge connecting the articulation point to ODD no of vertices and remove the other edges (if multiple edges with odd vertices are there , then select any one ) and then continue with your algorithm again,

–> If no, then just check how many vertices are there, if even then “YES” if odd then “NO”.
Thats pretty much it :slight_smile:

1 Like

Hi! I also used Havel-Hakimi theorem but also got WA… Used same idea as you did :slight_smile:

The randomness means Xij should be chosen randomly

@mecodesta Indeed, my algo will fail in that test case. Thanks for pointing it out!

First Things FIRST:

  1. Interesting problem (though a ready-made algorithm was available).

  2. Good that the problem statement did not mention any unwanted stuff like (no ODD cycles and all), else it would have been simple bi-partate matching.

  3. Tutte Matrix was a really interesting method.

Issues:

  1. I was on this problem for many days, trying to implement blossom’s algo flawlessly (Couldn’t succeed though). And eventually many brute-force and normal BP-Matching solutions passed, definitely due to lack of proper cases not because their algo is apt.

  2. Shangjingbo’s comment which says they couldn’t monitor all the solutions, wasn’t convincing. So if you can neither design proper cases, nor monitor solutions which get accepted with flaws, why frame a problem ? That was disappointing due to improper testing.

4 Likes

i can’t understand ,why is it giving wrong answer…(it runs fine on my compiler)
…
please help…
//www.codechef.com/JAN14/problems/SEAGRP/

#include
using namespace std;
#include<stdio.h>
#define max 100

int main()
{
int t,m,n,i,x,y;
scanf("%d",&t);
while(t–)
{
scanf("%d%d",&n,&m);
int f[max]={0},a[max]={0};
for(i=0 ; i<m ; i++)
{
scanf("%d%d",&x,&y);
f[x]++;
f[y]++;
}
for(i=1 ; i<=n ; i++)
{
a[f[i]]++;
}
for(i=1 ; i<=n ; i++)
{
if(a[i]%2 || f[i]==0)
break;
}
if(i==n+1)
printf(“Yes\n”);
else
printf(“No\n”);
}
return 0;
}

i can’t understand ,what your code is doing…(it’s unformatted) … please edit it so that it’d be readable…

@mbrc Can you please explain what are you doing in your above code.