제출 #418455

#제출 시각아이디문제언어결과실행 시간메모리
418455Bill_00로봇 (IOI13_robots)C++14
39 / 100
3076 ms53568 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; vector<int>s[1000005]; bool vis[1000005]; vector<pair<int,int> >v; int putaway(int A, int B, int T, int X[], int Y[], int W[], int H[]) { sort(X,X+A); sort(Y,Y+B); for(int i=0;i<T;i++){ if(W[i]>=X[A-1] && H[i]>=Y[B-1]) return -1; } for(int i=0;i<A;i++){ for(int j=0;j<T;j++){ if(W[j]<X[i]) s[i].push_back(j); } } for(int i=0;i<B;i++){ for(int j=0;j<T;j++){ if(H[j]<Y[i]) s[i+A].push_back(j); } } for(int i=0;i<(A+B);i++) v.push_back({s[i].size(),i}); int k=0,ans=0; while(k<T){ for(int i=0;i<=(A+B-1);i++){ int id=v[i].second; while(s[id].size()>0 && vis[s[id].back()]==1) s[id].pop_back(); if(s[id].size()){ vis[s[id].back()]=1; s[id].pop_back(); k++; } } ans++; } return ans; }
#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...