이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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(), cmp);
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) {
if(A == 0) swap(X, Y), swap(arr[0].ff, arr[0].ss),
swap(arr[1].ff, arr[1].ss);
if(X[0] > arr[0].ff && X[1] > arr[1].ff)
return 1;
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... |