This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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); sort(Y, Y+b);
sort(W, W+t);
if (W[t-1] > X[a-1]) return -1;
int mc = a-1; int toy = t-1; int cnt = 0;
vector<int> exc(a, 0);
while (mc){
while (X[mc-1] < W[toy]) toy--, cnt++;
exc[mc] = cnt; cnt = 0; mc--;
}
exc[mc] = toy+1;
int ans = 1;
for (int i=a-2; i>=0; i--) exc[i] = exc[i+1]+exc[i];
for (int i=0; i<a; i++) ans = max(ans, exc[i]/(a-i));
return ans;
}
/*
5
0
9
1 5 10 15 20
1 0
2 0
3 0
5 0
8 0
12 0
14 0
19 0
20 0
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |