Submission #1106031

#TimeUsernameProblemLanguageResultExecution timeMemory
1106031LuvidiRobots (IOI13_robots)C++17
0 / 100
1 ms4644 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; int putaway(int a, int b, int n, int x[], int y[], int w[], int s[]) { sort(x,x+a); sort(y,y+b); for(int i=0;i<n;i++){ if((a&&w[i]>=x[a-1])&&(b&&s[i]>=y[b-1]))return -1; } pair<int,int> t[n]; for(int i=0;i<n;i++)t[i]={w[i],s[i]}; sort(t,t+n); int l=0,r=n; while(l<r){ int m=(l+r)/2; int idx=0; priority_queue<int> pq; for(int i=0;i<a;i++){ while(idx<n&&t[idx].first<x[i]){ pq.push(t[idx].second); idx++; } for(int c=0;c<m&&!pq.empty();c++){ pq.pop(); } } while(idx<n){ pq.push(t[idx].second); idx++; } bool pos=1; for(int i=b-1;i>-1;i--){ for(int c=0;c<m&&!pq.empty();c++){ if(pq.top()<y[i])pq.pop(); else{ pos=0; break; } } if(!pos)break; } if(pos)r=m; else l=m+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...