제출 #298176

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2981762020-09-12 13:46:21williamMBDK로봇 (IOI13_robots)C++11
0 / 100
1 ms512 KiB
#include<bits/stdc++.h>
using namespace std;
#include "robots.h"
vector<int> xs, ys, as, bs;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
as = vector<int> (A), bs = vector<int> (B), xs = vector<int> (T), ys = vector<int> (T);
for(int i = 0; i < T; i++) xs[i] = W[i]; //cout << xs[i] << " ";
for(int i = 0; i < T; i++) ys[i] = S[i];
for(int i = 0; i < A; i++) as[i] = X[i]; //cout << i << " " << as[i] << " ";
for(int i = 0; i < B; i++) bs[i] = Y[i];
sort(xs.begin(), xs.end());
sort(ys.begin(), ys.end());
sort(as.begin(), as.end());
sort(bs.begin(), bs.end());
if(xs[T-1] > as[A-1]) return -1;
int res = 0;
priority_queue<int> q;
for(int i = T - 1; i >= 0; i--){
if(q.empty()) q.push(A-1), res++;
auto t = q.top(); q.pop();
if(as[t] < xs[i]){
q.push(t);
if(A > 1) q.push(A-2);
res++;
}
if(t > 0) q.push(t-1);
}
return res;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...