提交时间:2024-10-02 15:07:26
运行 ID: 32931
#include<bits/stdc++.h> using namespace std; const int N=2e5+10,INF=1e9; int n,h,k; int x[N],d[N]; int qx,qd; int cnt; int ans; priority_queue<double> pq; void insert(int x){ if(pq.size()<h) pq.push(x); else if(pq.top()>x){ pq.push(x); pq.pop(); } } double calc(double x){ double ret=x/2.0; return ret; } signed main(){ scanf("%d%d%d",&n,&h,&k); for(int i=1;i<=n;i++) scanf("%d",&x[i]); for(int i=1;i<=n;i++){ scanf("%d",&d[i]); if(d[i]==-1){ cnt++; insert(x[i]); } } while(k--){ scanf("%d%d",&qx,&qd); if(qd==-1){ cnt++; insert(qx); } if(cnt<h) printf("Zombie ate your brain\n"); else printf("%.1f\n",calc(pq.top())); } return 0; }