#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
// sub1
assert(T == 2 && A + B == 2);
pii toys[2];
if (A == 2) {
toys[0] = {W[0], S[0]};
toys[1] = {W[1], S[1]};
sort(X, X + A);
sort(toys, toys + 2);
if (toys[0].first < X[0] && toys[1].first < X[1]) {
return 1;
} else if (toys[1].first < X[1]) {
return 2;
} else {
return -1;
}
} else if (B == 2) {
toys[0] = {S[0], W[0]};
toys[1] = {S[1], W[1]};
sort(Y, Y + B);
sort(toys, toys + 2);
if (toys[0].first < Y[0] && toys[1].first < Y[1]) {
return 1;
} else if (toys[1].first < Y[1]) {
return 2;
} else {
return -1;
}
} else {
int w = X[0], s = Y[0];
if ((W[0] < w && S[1] < s) ||
(S[0] < s && W[1] < w)) {
return 1;
} else if ((W[0] < w && W[1] < w) || (S[0] < s && S[1] < s)) {
return 2;
} else {
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... |