Submission #254275

#TimeUsernameProblemLanguageResultExecution timeMemory
254275AaronNaiduRobots (IOI13_robots)C++14
90 / 100
3068 ms23132 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); reverse(X, X+A); sort(Y, Y+B); reverse(Y, Y+B); vector<pair<int, int> > toys; for (int i = 0; i < T; i++) { toys.push_back({W[i], S[i]}); } sort(toys.begin(), toys.end()); reverse(toys.begin(), toys.end()); for (int i = 0; i < T; i++) { if (W[i] >= X[0] and S[i] >= Y[0]) { return -1; } } float maxMinutes = 0; for (int i = 0; i <= B; i++) { float toyCount = 0; float robotCount; if (i == 0) { robotCount = 1; } else { robotCount = 0; } vector<int> remToys; for (int k = 0; k < T; k++) { if (i == B or toys[k].second >= Y[i]) { remToys.push_back(toys[k].first); } } while (toyCount < remToys.size() and robotCount < A) { if (remToys[int(toyCount)] >= X[int(robotCount)]) { toyCount++; } else { maxMinutes = max(maxMinutes, toyCount/(i+robotCount)); robotCount++; } } maxMinutes = max(maxMinutes, float(remToys.size())/float(i+robotCount)); } maxMinutes = ceil(maxMinutes); return int(maxMinutes); }
#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...