Submission #67567

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
675672018-08-15 02:33:31thebesRobots (IOI13_robots)C++14
100 / 100
2318 ms15596 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int MN = 1e6+6;
pair<int,int> wts[MN];
priority_queue<int> q;
int N, M, T, i;
vector<int> a, b;
bool check(int m){
while(q.size()) q.pop();
int i=0, j = 0;
for(i=0,j=0;i<N;i++){
while(j<T&&wts[j].first<a[i]) q.push(wts[j++].second);
for(int k=0;k<m&&q.size();k++) q.pop();
}
for(;j<T;j++) q.push(wts[j].second);
for(int k=b.size()-1;k>=0;k--){
for(int i=0;i<m&&q.size()&&q.top()<b[k];i++) q.pop();
}
return q.empty();
}
int putaway(int A,int B,int t,int *X,int *Y,int *W,int *S){
N = A, M = B, T = t;
for(int i=0;i<T;i++)
wts[i] = {W[i],S[i]};
for(int i=0;i<N;i++)
a.push_back(X[i]);
for(int i=0;i<M;i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:37:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m = lo+hi>>1;
           ~~^~~
#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...