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.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | nor | 157 |
4 | atcoder_official | 156 |
4 | cry | 156 |
6 | -is-this-fft- | 155 |
7 | maroonrk | 154 |
7 | adamant | 154 |
9 | Um_nik | 152 |
10 | djm03178 | 146 |
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 ?
Название |
---|