제출 #254274

#제출 시각아이디문제언어결과실행 시간메모리
254274AaronNaidu로봇 (IOI13_robots)C++14
76 / 100
3096 ms10768 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({S[i], W[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 <= A; 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 == A or toys[k].second >= X[i]) { remToys.push_back(toys[k].first); } } while (toyCount < remToys.size() and robotCount < B) { if (remToys[int(toyCount)] >= Y[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...