This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#include"robots.h"
/*#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
template<class T>
using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
/**/
typedef int ll;
//typedef long long ll;
typedef unsigned long long ull;
typedef __int128 vll;
typedef unsigned __int128 uvll;
ll _i=0;
#define ffn(x) _i=x
#define llll std::pair<ll , ll>
#define stitr set<ll>::iterator
#define fora(y,x) for(ll y=_i;x>y;y++)
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e9+7;
const ll ous = 4e5 + 7;
const ll dx[4] = {1 , 0 , 0 , -1} , dy[4] = {0,1,-1,0};
int putaway(int a,int b,int t, int x[],int y[],int w[],int s[]){
llll ar[t];
fora(i , t){
ar[i] = {w[i] , s[i]};
}
std::sort(ar , ar+t);
if(a != 0){
std::sort(x , x + a);
}
if(b != 0){
std::sort(y , y + b);
}
ll mxa = 0 , mxb = 0;
fora(i , a){
mxa =std::max(mxa , x[i]);
}
fora(i , b){
mxb =std::max(mxb , y[i]);
}
fora(i , t){
if(ar[i].fi >= mxa && ar[i].sec >= mxb){
return -1;
}
}
ll l = 1 , r = t;
while(r > l){
ll md = (l + r) / 2;
ll j = 0;
std::priority_queue<ll> pq;
fora(i , a){
while(x[i] > ar[j].fi && t > j){
pq.push(ar[j].sec);
j++;
}
ll s = 0;
while(md > s && !pq.empty()){
s++;
pq.pop();
}
}
while(t > j){
pq.push(ar[j].sec);
j++;
}
for(ll i = b-1;0<=i;i--){
ll s = 0;
while(md > s && !pq.empty() && pq.top() < y[i]){
s++;
pq.pop();
}
}
if(pq.empty()){
r = md;
}
else{
l = md + 1;
}
}
return l;
}
/*signed main(){
std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
ll t=1;
std::cin >> t;
ll o = 1;
while(t--){
//cout << "Case " << o++ << ":\n";
solve();
}
return 0;
}*/
Compilation message (stderr)
robots.cpp:13:1: warning: "/*" within comment [-Wcomment]
13 | /**/
|
# | 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... |