Hey, when all nodes degree is 1 i automatically output "I am superman", or when there is one node with 2 degree, i check if it makes it acyclic by visiting the first node, and then the second node?
This code gives me TLE http://codepad.org/MJ3c9OGF (in this code the first theory, when all nodes ...
Search found 7 matches
- Sun Jan 09, 2011 2:20 am
- Forum: Volume 118 (11800-11899)
- Topic: 11893 - Fabulous DAGy
- Replies: 10
- Views: 4680
- Mon Nov 01, 2010 5:22 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11893 - Fabulous DAGy
- Replies: 10
- Views: 4680
Re: 11893 - Fabulous DAGy
So you should find the cycle which is equal to the number of vertices by visiting them at most once?
- Mon Oct 04, 2010 1:52 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11857 - Driving Range
- Replies: 21
- Views: 12077
Re: 11857 - Driving Range
I don't know why but I'm not able to understand those graph problems. Do you think i am the problem or problem description is not so good ? And can you give me some guide to improve the ability of understanding the problem.
- Mon Oct 04, 2010 1:48 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11833 - Route Change
- Replies: 13
- Views: 5335
Re: 11833 - Route Change
Yes, i understood that but can you explain me the condition ?
- Sat Oct 02, 2010 5:57 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11833 - Route Change
- Replies: 13
- Views: 5335
Re: 11833 - Route Change
Dude, can you explain me the problem, i am not able to understand it by reading the problem description 

- Thu Sep 23, 2010 1:02 am
- Forum: Volume 118 (11800-11899)
- Topic: 11838 - Come and Go
- Replies: 22
- Views: 11256
Re: 11838 - Come And Go
Run DFS from each node, after each run, check if you have visited all the nodes, if yes, tmp++ and at the end, if tmp == n print YES otherwise NO.
- Thu Sep 23, 2010 12:59 am
- Forum: Volume 118 (11800-11899)
- Topic: 11810 - Gentle ping, to the old King
- Replies: 0
- Views: 3110
11810 - Gentle ping, to the old King
What's wrong with my code ? Any tricky case ?
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#define maxn 16
#define inf 1000
using namespace std;
struct edge {
int v, w;
edge () {}
edge (int _v, int _w) : v(_v), w(_w ...
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#define maxn 16
#define inf 1000
using namespace std;
struct edge {
int v, w;
edge () {}
edge (int _v, int _w) : v(_v), w(_w ...