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 <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using pi = pair<ll, pair<ll, ll>>;
using ii = pair<int, int>;
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
bool cmp(ii A, ii B) {
return max(A.ff, A.ss) < max(B.ff, B.ss);
}
int putaway(int A, int B, int T, int X[],
int Y[], int W[], int S[]) {
vector<ii> arr;
for(int l = 0; l < T; l++)
arr.pb({W[l], S[l]});
sort(arr.begin(), arr.end());
sort(X, X + A), sort(Y, Y + B);
for(int l = T - 1; l >= 0; l--) {
int U = arr[l].ff, V = arr[l].ss;
if(A > 0 && U < X[A - 1]) continue;
if(B > 0 && V < Y[B - 1]) continue;
return -1;
}
if(A == 0 || B == 0) return 2;
if(X[0] > arr[0].ff && Y[0] > arr[1].ss) return 1;
if(X[0] > arr[1].ff && Y[0] > arr[0].ss) 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... |