Submission #1270551

#TimeUsernameProblemLanguageResultExecution timeMemory
1270551BlockOGRobots (IOI13_robots)C++20
0 / 100
1 ms328 KiB
#include "robots.h" #include <bits/stdc++.h> // mrrrow meeow :3 // go play vivid/stasis now! https://vividstasis.gay #define fo(i, a, b) for (auto i = (a); i < (b); i++) #define of(i, a, b) for (auto i = (b); i-- > (a);) #define f first #define s second #define pb push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define be(a) a.begin(), a.end() using namespace std; int ____init = [] { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0; }(); int xw[1000000]; int ys[1000000]; bool check(int a, int b, int t, int x[], int y[], int c) { set<pair<int, int>> s; fo(i, 0, t) s.insert({xw[i], i}); fo(i, 0, a) { fo(_, 0, c) { if (s.empty()) return true; auto it = s.lb({i, -1}); if (it != s.end()) s.erase(it); else break; } } set<pair<int, int>> s2; for (auto [_, i] : s) s2.insert({ys[i], i}); of(i, 0, b) { fo(_, 0, c) { if (s2.empty()) return true; if (i >= s2.rbegin()->f) s2.erase(*s2.rbegin()); else return false; } } return s2.empty(); } int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]) { sort(x, x + a); sort(y, y + b); fo(i, 0, t) { xw[i] = ub(x, x + a, w[i]) - x; ys[i] = ub(y, y + b, s[i]) - y; if (xw[i] >= a && ys[i] >= b) return -1; } int l = 1, r = t; while (l < r) { int mid = (l + r) / 2; if (check(a, b, t, x, y, mid)) r = mid; else l = mid + 1; } return l; }
#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...