제출 #628653

#제출 시각아이디문제언어결과실행 시간메모리
628653whynotshadowRarest Insects (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef long long LL;
typedef long double ld;

#define el "\n"
#define se " "
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define mkp make_pair
#define srt(x,y) sort(x+1,x+1+y)
#define srtt(x,y,cmp) sort(x+1,x+1+y,cmp)
#define rev(x,y) reverse(x+1,x+1+y)
#define revv(x,y,cmp) reverse(x+1,x+1+y,cmp)
#define print(x) for (auto it : x) cout<<it<<se
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

const ll NN=2000+9;
const ll NNN=109;
const ll INF=1e9;
const ld PI=3.141592653589793238462643;
const ll MOD=1e9+7;

ll zero=0;
ll a,b,c,d,a1,b1,c1,val,i,sum1,j,n,m,pos,ans,sum,cur,res,ans1,res1;
ll k,kk,kkk,cnt,cnt1,l,r,x,y,mn,t,fl,q;
bool used[4009];
deque<ll>dek;
int min_cardinality(int N) {
    ll ans=N;
    for(ll i=0;i<N;i++){
       move_inside(i),dek.pb(i);
       if(press_button()>1){
           ans--;
           move_outside(i),dek.pop_back();
       }
    }
    if(ans==N || N/ans<=1) return 1;
    ll l=2,r=N/ans;
    ll cur=1;
    while(r-l>=0){
        ll mid=(l+r)>>1;
        for(ll i=0;i<N;i++){
            move_inside(i),dek.pb(i);
            if(press_button()>mid) move_outside(i),dek.pop_back();
        }
//        cout<<dek.size()<<" DEK\n";
        if(ans*mid==dek.size()) cur=mid,l=mid+1;
        else r=mid-1;
        while(!dek.empty()){
            move_outside(dek.front()),dek.pop_front();
        }
    }
    return cur;
}

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:62:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |         if(ans*mid==dek.size()) cur=mid,l=mid+1;
      |            ~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...