Submission #1091345

#TimeUsernameProblemLanguageResultExecution timeMemory
1091345LaMatematica14Robots (IOI13_robots)C++17
100 / 100
2659 ms33944 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; bool cont(int A, int B, int T, int X[], int Y[], int W[], int S[], int tr) { vector<array<int, 2>> ro(T+A); for (int i = 0; i < T; i++) ro[i] = {W[i], S[i]}; for (int i = T; i < T+A; i++) ro[i] = {X[i-T], -1}; sort(ro.begin(), ro.end()); priority_queue<int> pq; for (int i = 0; i < A+T; i++) { if (ro[i][1] == -1) { int c = 0; while (!pq.empty() && c < tr) { pq.pop(); c++; } } else pq.push(ro[i][1]); } vector<array<int, 2>> rv(B); for(int i = 0; i < B; i++) rv[i] = {Y[i], -1}; while (!pq.empty()) { rv.push_back({pq.top(), 0}); pq.pop(); } sort(rv.begin(), rv.end()); for (int i = 0; i < rv.size(); i++) { if (rv[i][1] == -1) { int c= 0; while (!pq.empty() && c < tr) { pq.pop(); c++; } } else pq.push(rv[i][1]); } if (pq.empty()) return 1; return 0; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { int l = 0, r = T+1; while (l < r-1) { int m = (l+r)/2; if (cont(A, B, T, X, Y, W, S, m)) r = m; else l = m; } if (r == T+1) return -1; return r; }

Compilation message (stderr)

robots.cpp: In function 'bool cont(int, int, int, int*, int*, int*, int*, int)':
robots.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 0; i < rv.size(); i++) {
      |                     ~~^~~~~~~~~~~
#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...