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;
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define F first
#define S second
typedef pair<int, int> pii;
const int N = 50010;
const int INF = 2e9+1;
bool used[N];
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[])
{
int tim = 0, done = 0;
bool ok = true;
while (ok) {
++tim;
ok = false;
forn(i, A) {
pii mx(-1, -1);
forn(j, T) if (!used[j] && W[j] < X[i])
mx = max(mx, pii(S[j], j));
if (mx != pii(-1, -1)) {
used[mx.S] = true;
ok = true;
++done;
continue;
}
}
forn(i, B) {
pii mx(-1, -1);
forn(j, T) if (!used[j] && S[j] < Y[i])
mx = max(mx, pii(W[j], j));
if (mx != pii(-1, -1)) {
used[mx.S] = true;
ok = true;
++done;
continue;
}
}
if (done == T)
return tim;
}
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... |