Submission #857893

#TimeUsernameProblemLanguageResultExecution timeMemory
857893Muhammad_AneeqPotemkin cycle (CEOI15_indcyc)C++17
Compilation error
0 ms0 KiB
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #pragma GCC optimize("O2") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <iostream> #include <vector> #include <set> #include <algorithm> #include <map> using namespace std; int const N=2000; vector<int>nei[N]={}; int vis[N]={}; vector<int>z; bool check(vector<int>g) { map<int,int>cnt; for (auto i:g) { for (auto j:nei[i]) cnt[j]++; } for (auto i:g) { if (cnt[i]!=2) return 0; } return 1; } void ans(vector<int>g) { reverse(g.begin(), g.end()); for (auto i:g) cout<<i<<' '; cout<<endl; _Exit(0); } void dfs(int x) { vis[x]=1; z.push_back(x); for (auto i:nei[x]) { if (vis[i]) { vector<int>g; for (int j=z.size()-1;j>=0;j--) { g.push_back(z[j]); if (z[j]==i) break; } if (g.size()>=4&&check(g)) ans(g); } else dfs(i); } if (z.size()) z.pop_back(); vis[x]=0; } inline void solve() { int n,m; cin>>n>>m; for(int i=1;i<=m;i++) { int a,b; cin>>a>>b; nei[a].push_back(b); nei[b].push_back(a); } dfs(2); cout<<"no\n"; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve();

Compilation message (stderr)

indcyc.cpp: In function 'int main()':
indcyc.cpp:84:16: error: expected '}' at end of input
   84 |         solve();
      |                ^
indcyc.cpp:82:1: note: to match this '{'
   82 | {
      | ^