Re: 10779 - Collectors Problem
Posted: Tue Feb 10, 2015 6:18 pm
I had tried all testcase in this post, and got the correct answer
also I got correct answer for my other testcase:
that has correct answer:
but it still get verdict wrong answer in oj
my graph is divided in 3 part and that grouping the vertex :
- different sticker which Bob will trade
- N-1 friend
- different sticker which Bob will get
this is my code for build the graph with source=0 and sink=131 (i'm using standard edmond karp algorithm):
please help, if anybody have any cornercase, it will helpful
thanks, sorry for my bad english
also I got correct answer for my other testcase:
Code: Select all
1
4 5
5 1 1 1 5 5
4 1 3 3 5
4 1 4 4 5
4 2 2 2 2
Code: Select all
Case #1: 4

my graph is divided in 3 part and that grouping the vertex :
- different sticker which Bob will trade
- N-1 friend
- different sticker which Bob will get
this is my code for build the graph with source=0 and sink=131 (i'm using standard edmond karp algorithm):
Code: Select all
...
cin>>k;
for(i=1; i<=k; i++)
{
cin>>a[i];
AdjMat[0][a[i]]++;
AdjMat[a[i]][a[i]+80]=1;
}
for(i=1; i<=28; i++)
{
AdjMat[i+80][131]=1;
}
for(i=0; i<n-1; i++)
{
cin>>t;
vi tmp;
tmp.clear();
memset(sk,0,sizeof sk);
for(j=0; j<t; j++)
{
cin>>l;
tmp.pb(l);
sk[l]++;
}
for(j=1; j<=m; j++)
{
if(!sk[j])
{
AdjMat[j][i+30]=1;
for(l=0; l<tmp.size(); l++)
{
if(sk[tmp[l]]>1)
{
AdjMat[i+30][tmp[l]+80]=1;
AdjMat[i+30][tmp[l]]=sk[tmp[l]]-2;
}
}
}
}
}
...
thanks, sorry for my bad english