# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347386 | Kerim | Robots (IOI13_robots) | C++17 | 1821 ms | 24616 KiB |
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 "robots.h"
#include "bits/stdc++.h"
#define MAXN 1000009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
PII arr[MAXN];
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(X,X+A);sort(Y,Y+B);reverse(Y,Y+B);
for(int i=0;i<T;i++)arr[i]=mp(W[i],S[i]);
sort(arr,arr+T);int st=1,en=T+1;
while(st<en){
priority_queue<int>q;
int mid=(st+en)>>1,p=0,f;
for(int i=0;i<A;i++){
while(p<T and arr[p].ff<X[i])q.push(arr[p++].ss);f=mid;
while(!q.empty() and f>=1)f--,q.pop();
}int ok=1;
while(p<T)q.push(arr[p++].ss);
for(int i=0;ok and !q.empty() and i<B;i++){
f=mid;
while(!q.empty() and f>=1){
if(q.top()>=Y[i]){
ok=0;break;
}q.pop();f--;
}
}ok&=(q.empty());
if(ok)en=mid;
else st=mid+1;
}
if(st==T+1)return -1;return st;
}
Compilation message (stderr)
# | 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... |