제출 #706293

#제출 시각아이디문제언어결과실행 시간메모리
706293danikoynov드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; const int maxn = 2010; int par[maxn], rnk[maxn]; int find_leader(int v) { return (v == par[v]) ? v : (par[v] = find_leader(par[v])); } void unite(int v, int u) { v = find_leader(v); u = find_leader(u); if (v == u) return; if (rand() % 2) swap(v, u); par[u] = v; rnk[v] += rnk[u]; } int used[maxn]; int min_cardinality(int N) { move_inside(0); for (int i = 0; i < N; i ++) { par[i] = i; rnk[i] = 1; } for (int i = 1; i < N; i ++) { move_inside(i); int act = press_button(); used[i] = 1; if (act == 1) continue; int j = 0; while(act == 2) { if (used[j]); { move_outside(j); act = press_button(); } j ++; } j --; unite(i, j); while(j >= 0) { if (used[j]) move_inside(j); j --; } move_outside(i); used[i] = 0; } int ans = N; for (int i = 0; i < N; i ++) ans = min(ans, rnk[find_leader(i)]); return ans; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:45:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   45 |             if (used[j]);
      |             ^~
insects.cpp:46:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   46 |             {
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...