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 "robots.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef pair <ll,ll> pii;
const ll N = 110;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort (X, X + A);
sort (W, W + T);
int lw = 1, hg = T + 1;
while (lw < hg) {
int mi = (lw + hg) / 2;
int idx = A - 1;
int can = 1;
vector <int> use (A, 0);
for (int i = T - 1; i >= 0; --i) {
while (idx >= 0 && (use[idx] == mi || X[idx] <= W[i])) idx--;
if (idx < 0) {
can = 0;
break;
}
use[idx]++;
}
if (can) hg = mi;
else lw = mi + 1;
}
if (lw == T + 1) return -1;
return hg;
}
# | 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... |