제출 #726419

#제출 시각아이디문제언어결과실행 시간메모리
726419Huseyn123Rarest Insects (IOI22_insects)C++17
47.50 / 100
270 ms6828 KiB
#include "insects.h" #include <bits/stdc++.h> #define MAX 200001 #define INF LLONG_MAX #define MOD 1000000007 #define mp make_pair #define mt make_tuple #define pb push_back #define ins insert #define ff first #define ss second #define gett(x,m) get<m>(x) #define all(a) a.begin(),a.end() #define lb(a,b) lower_bound(all(a),b) #define ub(a,b) upper_bound(all(a),b) #define sortv(a) sort(all(a)) #define sorta(a,sz) sort(a,a+sz) #define inputar(a,b){\ for(int i=0;i<b;i++){\ cin >> a[i];\ }\ } #define inputvec(a,b){\ for(int i=0;i<b;i++){\ ll num;\ cin >> num;\ a.pb(num);\ }\ } #define outputar(a,b){\ for(int i=0;i<b;i++){\ cout << a[i] << " ";\ }\ cout << "\n";\ } #define outputvec(a){\ for(auto x:a){\ cout << x << " ";\ }\ cout << "\n";\ } using namespace std; typedef long long ll; typedef unsigned long long ull; typedef tuple<ll,ll,ll> tll; typedef pair<ll,ll> pll; typedef double db; typedef long double ldb; inline void USACO(string filename){ freopen((filename+".in").c_str(),"r",stdin); freopen((filename+".out").c_str(),"w",stdout); } ll n,q,t=1,m,n2,m2,k,cnt=0,a[MAX],b[MAX],d[MAX],d2[MAX],x,y,z,x2,y2,z2,res1=0,cnt1,cnt2,cnt3; ll c[1001][1001]; ll c2[1001][1001]; ll fact[MAX]; ll inv_fact[MAX]; //char c; string str[MAX]; string s1,s2; const int mod = 998244353; set<ll> st1; int h=0; int h2=0; bool f(int v){ for(auto x:st1){ move_outside(x); } st1.clear(); ll cnt=0; ll prev=-1; for(int i=0;i<n;i++){ move_inside(i); st1.ins(i); ll ans=press_button(); if(ans>v){ move_outside(i); st1.erase(i); cnt++; } } h2=v; //cout << v << " " << cnt << "\n"; return cnt==n-v*h; } int min_cardinality(int N) { n=N; for(int i=0;i<n;i++){ move_inside(i); st1.ins(i); ll ans=press_button(); if(ans>1){ move_outside(i); st1.erase(i); } else if(ans==1){ h++; } } //cout << h << "\n"; int l,r,mid; l=1; r=N; while(l<r){ mid=(l+r+1)/2; if(f(mid)){ l=mid; } else{ r=mid-1; } } return r; }

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

insects.cpp: In function 'bool f(int)':
insects.cpp:71:8: warning: unused variable 'prev' [-Wunused-variable]
   71 |     ll prev=-1;
      |        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...