제출 #298180

#제출 시각아이디문제언어결과실행 시간메모리
298180williamMBDK로봇 (IOI13_robots)C++11
14 / 100
314 ms19660 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(A == 0 || 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(xs[i] >= as[t]){ q.push(t); if(A > 1) q.push(A-2); res++; }else if(t > 0) q.push(t-1); } return res; }
#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...