제출 #244442

#제출 시각아이디문제언어결과실행 시간메모리
244442errorgornPotemkin cycle (CEOI15_indcyc)C++14
70 / 100
1098 ms2688 KiB
//雪花飄飄北風嘯嘯 //天地一片蒼茫 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define ll long long #define ii pair<ll,ll> #define iii pair<ii,ll> #define fi first #define se second #define endl '\n' #define debug(x) cout << #x << " is " << x << endl; #define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() ll MAX(ll a){return a;} ll MIN(ll a){return a;} template<typename... Args> ll MAX(ll a,Args... args){return max(a,MAX(args...));} template<typename... Args> ll MIN(ll a,Args... args){return min(a,MIN(args...));} #define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); int n,m; vector<int> al[1005]; bool am[1005][1005]; //bruh int A,B; bool vis[1005]; vector<int> stk; bool dfs(int i){ if (vis[i]) return false; vis[i]=true; if (am[i][A] && am[i][B]) return false; stk.push_back(i); if (i==B) return true; for (auto &it:al[i]){ if (i==A && it==B) continue; if (dfs(it)) return true; } stk.pop_back(); return false; } void test(int i,int j){ memset(vis,false,sizeof(vis)); stk.clear(); A=i,B=j; if (dfs(i)){ //cout<<i<<" "<<j<<endl; //for (auto &it:stk) cout<<it<<" ";cout<<endl; for (int x=0;x<sz(stk);x++){ for (int y=x+2;y<sz(stk);y++){ if (x==0 && y==sz(stk)-1) continue; //bruh //cout<<"debug: "<<x<<" "<<y<<endl; if (am[stk[x]][stk[y]]){ stk.erase(stk.begin()+x+1,stk.begin()+y); y=x+1; } } } for (auto &it:stk) cout<<it<<" "; cout<<endl; exit(0); } } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; int a,b; while (m--){ cin>>a>>b; am[a][b]=am[b][a]=true; al[a].push_back(b); al[b].push_back(a); } rep(x,1,n+1) rep(y,x+1,n+1) if (am[x][y]) test(x,y); cout<<"no"<<endl; }

컴파일 시 표준 에러 (stderr) 메시지

indcyc.cpp: In function 'void test(int, int)':
indcyc.cpp:80:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for (auto &it:stk) cout<<it<<" "; cout<<endl;
   ^~~
indcyc.cpp:80:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for (auto &it:stk) cout<<it<<" "; cout<<endl;
                                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...