Submission #418436

#TimeUsernameProblemLanguageResultExecution timeMemory
418436Bill_00Robots (IOI13_robots)C++14
39 / 100
1715 ms36656 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; vector<int>s[1000]; bool vis[100000]; 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); } } int k=0,ans=0; while(k<T){ for(int i=0;i<=(A+B-1);i++){ while(s[i].size()>0 && vis[s[i].back()]==1) s[i].pop_back(); if(s[i].size()){ vis[s[i].back()]=1; s[i].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...