#include #include #include #include #include #include using namespace std; int n,m,maxSum=-1; vector *graph; int *used; queue bestPath; void read() { // fstream fin; // fin.open("maxpath.in",fstream::in|fstream::binary); cin>>n>>m; graph=new vector[n]; used=new int[n]; for(int i=0;i>a>>b; graph[a-1].push_back(b-1); graph[b-1].push_back(a-1); } for(int i=0;i=0;i--) { //cout<<"graph["< curPath) { return ; } //5 5 //1 2 //2 3 //2 5 //2 4 //3 5 void solve() { stack curPath; cout<<"v solve"<=0;i--) { int l=0; used[i]=1; curPath.push(i+1); int j=graph[i].size()-1; stack curNode; curNode.push(i); while(curNode.top()!=i||l==0) { cout<<1< tempPath; queue tempQueue; int curSum=0,k=1; while(!curPath.empty()) { curSum+=k*curPath.top(); cout<<"curSum="<maxSum) { cout<<"pochvam s promenite na bestPath"<