Submission #494018

#TimeUsernameProblemLanguageResultExecution timeMemory
494018TeaTimeRobots (IOI13_robots)C++17
90 / 100
3077 ms13536 KiB
#include "robots.h" #include <iostream> #include <string> #include <algorithm> #include <vector> #include <set> #include <map> using namespace std; typedef long long ll; typedef long double ld; #define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { ll mx = 1e6 + 100; int l = 0, r = T + 1; vector<ll> svd; for (int i = 0; i < A; i++) svd.push_back(X[i]); sort(svd.rbegin(), svd.rend()); vector<pair<int, int>> vec; for (int i = 0; i < T; i++) vec.push_back({ W[i], S[i] }); while (r - l > 1) { int mid = (l + r) / 2; vector<int> skip(T); map<int, int> st; for (int i = 0; i < B; i++) { st[Y[i]] += mid; } sort(vec.rbegin(), vec.rend()); for (int i = 0; i < T; i++) { if (st.upper_bound(vec[i].second) != st.end()) { ll x = (*st.upper_bound(vec[i].second)).first; st[x]--; skip[i] = 1; if (st[x] == 0) st.erase(x); } } ll pt = 0, pt2 = 0; bool f = 1; for (int i = 0; i < T; i++) { if (skip[i]) continue; if (svd.size() > pt && svd[pt] > vec[i].first) { pt2++; if (pt2 == mid) { pt2 = 0; pt++; } } else { f = 0; break; } } if (f) { r = mid; } else { l = mid; } } if (r == T + 1) { return -1; } else { return r; } }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:53:28: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   53 |             if (svd.size() > pt && svd[pt] > vec[i].first) {
      |                 ~~~~~~~~~~~^~~~
robots.cpp:17:8: warning: unused variable 'mx' [-Wunused-variable]
   17 |     ll mx = 1e6 + 100;
      |        ^~
#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...