제출 #298306

#제출 시각아이디문제언어결과실행 시간메모리
298306Hemimor로봇 (IOI13_robots)C++14
100 / 100
2601 ms38168 KiB
#include "robots.h" #include <algorithm> #include <iostream> #include <iomanip> #include <numeric> #include <cassert> #include <vector> #include <cmath> #include <queue> #include <set> #include <map> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<int,P> pip; typedef vector<pip> vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; vip a,b; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X,X+A); sort(Y,Y+B); int n=T,mx=(A==0?0:X[A-1]),my=(B==0?0:Y[B-1]); a=b=vip(n); for(int i=0;i<n;i++){ if(W[i]>=mx&&S[i]>=my) return -1; a[i]={W[i],{S[i],i}}; b[i]={S[i],{W[i],i}}; } sort(a.begin(),a.end()); sort(b.begin(),b.end()); auto f=[&](int m){ priority_queue<P> q; vi c(n); int I=0,t=0; for(int i=0;i<A;i++){ while(I<n&&a[I].first<X[i]) q.push(a[I++].second); for(int j=0;j<m&&!q.empty();j++){ P p=q.top(); q.pop(); c[p.second]++; } } I=0; for(int i=0;i<B;i++){ while(I<n&&b[I].first<Y[i]){ if(!c[b[I].second.second]) t++; I++; } t=max(0,t-m); } while(I<n){ if(!c[b[I++].second.second]) return 0; } if(t==0) return 1; return 0; }; int l=0,r=n; while(r-l>1){ int m=(l+r)/2; if(f(m)) r=m; else l=m; } return r; }
#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...