Submission #547132

#TimeUsernameProblemLanguageResultExecution timeMemory
547132blueRobots (IOI13_robots)C++17
0 / 100
3055 ms29116 KiB
#include "robots.h" #include <vector> #include <iostream> #include <algorithm> #include <set> using namespace std; using pii = pair<int, int>; //weak #, small #, toys #, weight lim, size lim, weight, size int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); pii obj[T]; for(int t = 0; t < T; t++) obj[t] = pii{W[t], S[t]}; int lo = 1, hi = T; while(1) { int mid = (lo+hi)/2; multiset<int> sizes; // cerr << lo << ' ' << hi << '\n'; int it = -1; for(int a = 0; a < A; a++) { while(it+1 < T && obj[it+1].first < X[a]) { it++; sizes.insert(obj[it].second); } for(int z = 1; z <= mid && !sizes.empty(); z++) { sizes.erase(sizes.find(*sizes.rbegin())); } } while(it+1 < T) { it++; sizes.insert(obj[it].second); } for(int b = 0; b < B; b++) { for(int z = 1; z <= mid && !sizes.empty(); z++) { if(*sizes.begin() >= Y[b]) break; sizes.erase(sizes.begin()); } } if(lo == hi) { if(sizes.empty()) return lo; else return -1; } if(sizes.empty()) hi = mid; else lo = mid+1; } }
#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...