#include #include #include #include #include #include using namespace std; int cmp (int x, int y) { return x>y; } int n,m; bool used[100005]; int z[100005],ans[100005],ansSize; long long c; vector v[100005]; double t; void dfs (int pos, int num, long long score) { if ((clock()-t)/CLOCKS_PER_SEC>=4.8) return; used[pos]=true; score+=(long long)num*pos; z[num-1]=pos; bool flag=true; for (int i=0; ic) { for (int i=0; i=0; i--) { newscore+=(long long)z[i]*br; br++; } if (newscore>c) { for (int i=num-1; i>=0; i--) ans[num-i-1]=z[i]; c=newscore; ansSize=num; } } used[pos]=false; } int main() { t=clock(); freopen ("maxpath.in", "r", stdin); freopen ("maxpath.out", "w", stdout); ios::sync_with_stdio (false); cin.tie (nullptr); cout.tie (nullptr); cin>>n>>m; for (int i=0; i>x>>y; v[x].push_back(y); v[y].push_back(x); } for (int i=1; i<=n; i++) sort(v[i].begin(),v[i].end(),cmp); for (int i=n; i>=1; i--) { if ((clock()-t)/CLOCKS_PER_SEC>=4.8) break; //memset(used,0,sizeof(used)); dfs(i,1,0); } cout<