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>
using namespace std;
#include "robots.h"
//#define DEBUGGING
void __print(size_t i) { std::cerr << i; }
void __print(int i) { std::cerr << i; }
void __print(long long int i) { std::cerr << i; }
void __print(const char *c) { std::cerr << c; }
template<typename T>
void __print(T& t) { std::cerr <<"{";int f = 0; for (auto& i : t) { std::cerr << ((f++) ? ", ": ""); __print(i); } std::cerr << "}"; }
void _print() { std::cerr << "]\n"; }
template<typename T, typename... V>
void _print(T t, V... v) { __print(t); if (sizeof...(v)) std::cerr << ", "; _print(v...); }
#ifdef DEBUGGING
#define debug(x...) std::cerr << "[" << (#x) << "] = ["; _print(x)
#else
#define debug(x...)
#endif
constexpr static int MXSIZE = 1000;
int ceil_div(int a, int b)
{
debug(a, b);
return (a + b-1) / b;
}
int putaway(int a, int b, int t, int x[], int y[], int w[], int s[])
{
if (b == 0)
{
sort(x, x + a);
sort(w, w + t);
if (w[t-1] >= x[a-1])
return -1;
int cost = 0;
for (int i = t-1, j = a-1; i >= 0 && j > 0; i--)
{
if (w[i] < x[j-1])
cost = max(cost, ceil_div(t - i - 1, a - j));
while (j > 0 && w[i] < x[j-1]) j--;
}
cost = max(cost, ceil_div(t, a));
return cost;
}
return -1;
}
# | 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... |