제출 #1105036

#제출 시각아이디문제언어결과실행 시간메모리
1105036tammaidai로봇 (IOI13_robots)C++17
100 / 100
1390 ms24500 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; struct AB { int w,s; bool operator<(const AB&o)const{ return w<o.w; } }; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { int l = 1,r=1000001; vector<AB> t; for(int i = 0;i<T;i++){ t.push_back({W[i],S[i]}); } sort(t.begin(),t.end()); sort(X,X+A); sort(Y,Y+B); while(l<r){ int m = (l+r)>>1; int idx = 0; priority_queue<int> pq; for(int i = 0;i<A;i++){ for(;idx<T;idx++){ if(t[idx].w>=X[i])break; pq.push(t[idx].s); } // cout << pq.size()<<'\n'; int cnt = 0; while(!pq.empty() && cnt<m){ pq.pop(); cnt++; // cout << cnt <<'\n'; } } for(;idx<T;idx++){ pq.push(t[idx].s); } for(int i = B-1;i>=0;i--){ int cnt = 0; if(pq.empty() || pq.top()>=Y[i])break; while(!pq.empty() && cnt<m){ pq.pop(); cnt++; } } if(!pq.empty()){ l=m+1; } else{ r=m; } } if(l==1000001){ return -1; } return l; } // int inp1[5010] // int inp2[5010] // int inp3[5010] // int main(){ // cin.tie(nullptr)->sync_with_stdio(false); // }
#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...