제출 #436982

#제출 시각아이디문제언어결과실행 시간메모리
436982haojiandan열쇠 (IOI21_keys)C++17
37 / 100
160 ms16460 KiB
#include <bits/stdc++.h> using namespace std; const int maxn=2010; #define MP make_pair int n,m,p[maxn],r[maxn]; vector<pair<int,int> > g[maxn]; vector<pair<int,int> > rem[maxn]; int hd,tl,q[maxn]; bool vis_id[maxn],vis_col[maxn]; void insert_id(int x) { if (vis_id[x]) return; vis_id[x]=1; if (!vis_col[r[x]]) { for (pair<int,int> A : rem[r[x]]) { insert_id(A.first); } } q[++tl]=x; vis_col[r[x]]=1; } vector<int> find_reachable(vector<int> R,vector<int> U,vector<int> V, vector<int> C) { n=(int)R.size(); for (int i=0;i<n;i++) r[i+1]=R[i]+1; m=(int)U.size(); int x,y,z; for (int i=0;i<m;i++) { x=U[i]+1,y=V[i]+1,z=C[i]+1; g[x].push_back(MP(y,z)),g[y].push_back(MP(x,z)); } int mn=n+1; vector<int> ans(n,0); for (int s=1;s<=n;s++) { memset(vis_id,0,sizeof(vis_id)); memset(vis_col,0,sizeof(vis_col)); for (int j=1;j<=n;j++) rem[j].clear(); hd=1,tl=0; insert_id(s); while (hd<=tl) { int x=q[hd]; hd++; for (pair<int,int> A : g[x]) { int y=A.first; if (vis_id[y]) continue; if (vis_col[A.second]) insert_id(y); else rem[A.second].push_back(A); } } p[s]=tl; mn=min(mn,tl); } for (int i=1;i<=n;i++) if (p[i]==mn) ans[i-1]=1; return ans; }

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

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:46:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   46 |  for (int i=1;i<=n;i++) if (p[i]==mn) ans[i-1]=1; return ans;
      |  ^~~
keys.cpp:46:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   46 |  for (int i=1;i<=n;i++) if (p[i]==mn) ans[i-1]=1; return ans;
      |                                                   ^~~~~~
#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...