QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#537766#4565. Rarest InsectsYahia_Emara#Compile Error//C++202.1kb2024-08-30 18:07:502024-08-30 18:07:51

Judging History

你现在查看的是最新测评结果

  • [2024-08-30 18:07:51]
  • 评测
  • [2024-08-30 18:07:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define dbg(x) cout << (#x) << " : " << x << endl
#define pb push_back
#define bk(x) x.back()
#define all(x) x.begin(),x.end()
#define LOOP(n) for(int rp=0;rp<n;rp++)
#define sq(x) ((x)*(x))
typedef long long ll;
typedef long double dl;
const int SZ=5e5+7;
const ll INF=1e18+7;
const dl eps=1e-9;
int MOD=1e9+7;
mt19937_64 rng(time(0));
int rnd(int l,int r){
    return uniform_int_distribution<int>(l,r)(rng);
}
ll trig(ll x){
    return x*(x+1)/2;
}
int getN(){
    int n;cin >> n;
    return n;
}
#define cmbntrcs fact[0]=1;for(int i=1;i<SZ;i++)fact[i]=mul(fact[i-1],i);finv[SZ-1]=inv(fact[SZ-1]);for(int i=SZ-2;i>0;i--)finv[i]=mul(finv[i+1],i+1);
int fact[SZ],finv[SZ];
int add(int x,int y,int MOD=MOD){
    x+=y;if(x>=MOD)x-=MOD;
    return x;
}
int sub(int x,int y,int MOD=MOD){
    x-=y;if(x<0)x+=MOD;
    return x;
}
int mul(int x,int y,int MOD=MOD){
    return(x*1ll*y)%MOD;
}
int pwr(int x,ll b,int MOD=MOD){
    int rt=1;
    while(b>0){
        if(b&1)rt=mul(rt,x,MOD);
        x=mul(x,x,MOD),b>>=1;
    }
    return rt;
}
int inv(int x,int MOD=MOD){
    return pwr(x,MOD-2,MOD);
}
#include "insects.h"
#include "stub.cpp"
int n,p[SZ],a[SZ],k;
vector<int>v;
void ins(int i){
    move_inside(i);
    v.pb(i);
}
void dlt(){
    move_outside(bk(v));
    v.pop_back();
}
int card(){
    return press_button();
}
bool f(int c){
    for(int i=0;i<n;i++){
        ins(i);
        if(card()>c)dlt();
    }
    if(sz(v)==c*k)return 1;
    return 0;
}
int min_cardinality(int N){
    n=N;
    for(int i=0;i<n;i++){
        ins(i);
        if(card()>1)dlt();
    }
    k=sz(v);
    while(sz(v))dlt();
    int l=2,r=n/k,ans=1;
    while(l<=r){
        int md=(l+r)>>1;
        if(f(md))l=md+1,ans=md;
        else r=md-1;
        while(sz(v))dlt();
    }
    return ans;
}
/*int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    //cout << fixed << setprecision(12);
    int tt=1;
    //cin >> tt;
    LOOP(tt){
        //code
    }
    return 0;
}*/

详细

answer.code:52:10: fatal error: stub.cpp: No such file or directory
   52 | #include "stub.cpp"
      |          ^~~~~~~~~~
compilation terminated.