제출 #706288

#제출 시각아이디문제언어결과실행 시간메모리
706288danikoynov드문 곤충 (IOI22_insects)C++17
0 / 100
163 ms292 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 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(); if (act == 1) continue; int j = 0; while(act == 2) { move_outside(j); j ++; act = press_button(); } j --; unite(i, j); while(j >= 0) { move_inside(j); j --; } move_outside(i); } 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:38:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   38 |         if (act == 1)
      |         ^~
insects.cpp:40:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   40 |             int j = 0;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...