Submission #298330

#TimeUsernameProblemLanguageResultExecution timeMemory
298330Haunted_CppRobots (IOI13_robots)C++17
0 / 100
1 ms384 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<int> weak, small; for (int i = 0; i < A; i++) { weak.emplace_back(X[i]); } for (int i = 0; i < B; i++) { small.emplace_back(Y[i]); } vector<pair<int, int>> arr(T); for (int i = 0; i < T; i++) { arr[i] = {W[i], S[i]}; } sort(weak.begin(), weak.end()); sort(small.begin(), small.end()); auto works = [&](int time) { vector<pair<int, int>> item = arr; sort(item.begin(), item.end(), [&](auto a, auto b) { return a.first > b.first; }); for (auto to : weak) { int left = time; while(left && !item.empty() && item.back().first < to) { --left; item.pop_back(); } } return item.empty(); }; int lo = 0, hi = 1e9; while(lo < hi) { const int mid = lo + (hi - lo) / 2; if (works(mid)) hi = mid; else lo = mid + 1; } return (hi > 1e8 ? -1 : 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...