Submission #123744

#TimeUsernameProblemLanguageResultExecution timeMemory
123744MAMBARobots (IOI13_robots)C++17
0 / 100
3009 ms8336 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; #define rep(i , j , k) for (int i = j; i < (int)k; i++) const int MAXN = 1e6 + 10; int a[MAXN] , b[MAXN]; multiset<int> st; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { iota(a , a + T , 0); iota(b , b + T , 0); sort(a , a + T, [&](int l , int r) { return W[l] < W[r]; }); sort(b , b + T, [&](int l, int r) { return S[l] < S[r]; }); sort(X , X + A); sort(Y , Y + B, greater<int>()); int lo = -1, hi = T + 1; while (lo != hi - 1) { int mid = lo + hi >> 1; st.clear(); int ptr = 0; rep(i , 0 , A) { while (ptr < T && W[a[ptr]] < X[i]) st.insert(-S[a[ptr++]]); rep(j , 0 , mid) if (st.size()) st.erase(st.begin()); } rep(i , 0 ,B) rep(j , 0 , mid) if (st.size() && -(*st.begin()) < Y[i]) st.erase(st.begin()); if (st.empty()) hi = mid; else lo = mid; } if (hi == T + 1) hi = -1; return hi; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:26:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid = 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...