Hello, can you give me a hint on how to solve this problem? I read the editorial, but still can not solve it. According to the editorial, we have to "prune the graph". I don't know how to do that. Thanks so much.
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Hello, can you give me a hint on how to solve this problem? I read the editorial, but still can not solve it. According to the editorial, we have to "prune the graph". I don't know how to do that. Thanks so much.
Hello, i'm trying to solve this problem http://www.spoj.com/problems/PT07X/. I wrote a brute force algorithm. I was expecting a Time Limit Exceeded response, but I got WA instead. What is wrong with my code? Thanks!
vector<pair<int,int> > edge;
int n , a , b ,mini;
scanf("%d",&n);
for (int i = 1; i<=n-1; i++)
{
scanf("%d%d",&a,&b);
a--; b--;
edge.push_back(make_pair(a,b));
}
mini = INF;
for (int mask = 0; mask < (1<<n); mask++)
{
bool can = true;
for (int i = 0 ; i<edge.size(); i++)
{
if ( (mask&(1<<edge[i].first))==0 && (mask&(1<<edge[i].second))==0)
{
can = false;
break;
}
}
if (can)
{
int on = 0;
for (int i = 0 ; i<n; i++) if ( (mask&(1<<i))!= 0) on++;
mini = min(mini,on);
}
}
printf("%d\n",mini);
Hello guys, sometimes i'm having trouble proofing my algorithm correctness. I've seen many Editorial where the author make some lemmas and proof their correctness. Is there a book where I can learn something like that? I've read several books this , it doesn't help much.
Thanks guys!
Hello codeforces fella!
I hope you guys can give me some suggestions.
I am second year CS student in Indonesia. I have wasted lots of my time practicing algorithm in various online judges. I really enjoy doing it, but i don't think competitive programming will give me a job in the future (CMIIW).
Now the question is, is it worth doing it? Or should I just learn something that can give me a job like Web Design etc ?
Name |
---|