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"
//#include "grader.cpp"
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
using namespace std;
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)
int A, B, T;
const int MAXN = (int)1e6 + 6;
int X[MAXN], Y[MAXN], W[MAXN], S[MAXN];
int putaway(int AA, int BB, int TT, int XX[], int YY[], int WW[], int SS[]) {
A = AA;
B = BB;
T = TT;
for (int i = 0; i < A; i++) {
X[i] = XX[i];
}
for (int i = 0; i < B; i++) {
Y[i] = YY[i];
}
for (int i = 0; i < T; i++) {
W[i] = WW[i];
Y[i] = YY[i];
}
int max_x = 0;
for (int i = 0; i < A; i++) {
chkmax(max_x, X[i]);
}
int max_y = 0;
for (int i = 0; i < B; i++) {
chkmax(max_y, Y[i]);
}
for (int i = 0; i < T; i++) {
if (W[i] < max_x) {
continue;
}
else if (S[i] < max_y) {
continue;
}
else {
return -1;
}
}
auto can = [&](pair<int, char> robot, int pos) {
if (robot.sc == 'A') {
return W[pos] < robot.fr;
} else {
return S[pos] < robot.fr;
}
};
vector <pair<int, char>> vec;
for (int i = 0; i < A; i++) {
vec.pb(mk(X[i], 'A'));
}
for (int i = 0; i < B; i++) {
vec.pb(mk(Y[i], 'B'));
}
if (can(vec[0], 0) && can(vec[1], 1)) {
return 1;
}
if (can(vec[1], 0) && can(vec[0], 1)) {
return 1;
}
return 2;
}
# | 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... |