제출 #759176

#제출 시각아이디문제언어결과실행 시간메모리
759176Dan4Life게임 (IOI14_game)C++17
0 / 100
1 ms212 KiB
#include <iostream> using namespace std; int n, p[1501], sz[1501]; bool chk[1501][1501]; int findSet(int i){return i==p[i]?i:p[i]=findSet(p[i]);} void unionSet(int i, int j){ int x = findSet(i), y = findSet(j); if(x==y) return; if(sz[x]<sz[y]) swap(x,y); p[y] = x; sz[x]+=sz[y]; } void initialize(int N){ n = N; for(int i =0; i < N; i++) p[i]=i,sz[i]=1; } int hasEdge(int u, int v){ int cnt = 0; for(int i = 0; i < n and cnt<2; i++) if(findSet(i)==u) for(int j = i+1; j < n and cnt<2; j++) if(findSet(j)==v and chk[i][j]) cnt++; if(cnt==1) unionSet(u,v); chk[u][v]=chk[v][u]=1; return cnt==1; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:24:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   24 |     if(cnt==1) unionSet(u,v); chk[u][v]=chk[v][u]=1;
      |     ^~
game.cpp:24:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   24 |     if(cnt==1) unionSet(u,v); chk[u][v]=chk[v][u]=1;
      |                               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...