제출 #309995

#제출 시각아이디문제언어결과실행 시간메모리
309995juggernaut로봇 (IOI13_robots)C++14
100 / 100
1885 ms13168 KiB
#include"robots.h" #include<bits/stdc++.h> #define fr first #define sc second //#include"grader.c" using namespace std; int a,b,t,x[50005],y[50005]; pair<int,int>toy[1000005]; bool check(int m){ priority_queue<int>q; for(int i=0,tt=0;i<=a;i++){ for(;tt<t&&toy[tt].fr<x[i];tt++)q.push(toy[tt].sc); if(i!=a)for(int j=0;j<m&&(!q.empty());j++)q.pop(); } for(int i=b-1;i>=0&&(q.empty()||q.top()<y[i]);i--) for(int j=0;j<m&&(!q.empty());j++)q.pop(); return q.empty(); } int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){ a=A,b=B,t=T; x[a]=2e9+1; copy(X,X+A,x); copy(Y,Y+B,y); for(int i=0;i<t;i++)toy[i]={W[i],S[i]}; sort(x,x+a); sort(y,y+b); sort(toy,toy+t); int l=1,r=t; while(l<r){ int mid=(l+r)>>1; if(check(mid))r=mid; else l=mid+1; } if(!check(l))return -1; return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...