제출 #628087

#제출 시각아이디문제언어결과실행 시간메모리
628087haojiandan드문 곤충 (IOI22_insects)C++17
99.89 / 100
62 ms432 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int n; int p[10000]; int min_cardinality(int _n) { n=_n; vector<int> V; int cnt=0; for (int i=0;i<n;i++) p[i]=i; random_shuffle(p,p+n); for (int i=0;i<n;i++) { move_inside(p[i]); if (press_button()>1) move_outside(p[i]),V.push_back(p[i]); else cnt++; } if (cnt==1) return n; if (cnt==2) { for (int i=0;i<n;i++) move_inside(i); return n-press_button(); } int l=2,r=n/cnt,mid,res=1; int lst=1; while (l<=r) { mid=(l+r)>>1; vector<int> V1,V2; int c=0; for (int &x : V) { move_inside(x); if (press_button()>mid) move_outside(x),V2.push_back(x); else c++,V1.push_back(x); } if (c==cnt*(mid-lst)) { res=mid; V.swap(V2); lst=mid; l=mid+1; } else { r=mid-1; for (int &x : V1) move_outside(x); V.swap(V1); } } return res; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:8:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    8 |  for (int i=0;i<n;i++) p[i]=i; random_shuffle(p,p+n);
      |  ^~~
insects.cpp:8:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    8 |  for (int i=0;i<n;i++) p[i]=i; random_shuffle(p,p+n);
      |                                ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...