Submission #171092

#TimeUsernameProblemLanguageResultExecution timeMemory
171092dennisstarRobots (IOI13_robots)C++11
100 / 100
1952 ms24408 KiB
#include "robots.h" #include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; vector<pii> ar; priority_queue<int, vector<int>, less<int> > pq; int cn1[50010], cn2[50010]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); for (int i=0; i<T; i++) ar.push_back({W[i], S[i]}); sort(all(ar)); for (int i=0; i<T; i++) if (X[A-1]<=W[i]&&Y[B-1]<=S[i]) return -1; int s=0, e=T; int x; while (s+1<e) { ll md=(s+e+1)/2; int i, j, k; for (i=0, j=0; i<A; i++) { for (; X[i]>ar[j].fi&&j<T; j++) pq.push(ar[j].se); for (k=0; !pq.empty()&&k<md; k++) pq.pop(); } for (; j<T; j++) pq.push(ar[j].se); for (i=B-1; i>=0; i--) { for (j=0; !pq.empty()&&j<md&&pq.top()<Y[i]; j++) pq.pop(); } if (!pq.empty()) s=md; else e=md; while(!pq.empty()) pq.pop(); } return e; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:27:6: warning: unused variable 'x' [-Wunused-variable]
  int x;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...