Submission #223601

#TimeUsernameProblemLanguageResultExecution timeMemory
223601staniewzkiRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) using PII = pair<int, int>; #include "robots.h" int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X + A), sort(Y, Y + B); vector<PII> pts(T); REP(i, T) pts[i] = {W[i], S[i]}; sort(pts.begin(), pts.end()); auto check = [&](int q) { priority_queue<int> Q; int cur = 0; REP(i, A + 1) { while(cur < size(pts) && (i == A || pts[cur].fist < X[i])) Q.emplace(pts[cur++].second); if(i != A) REP(j, q) { if(Q.empty()) break; Q.pop(); } } for(int i = B - 1; i >= 0; i--) { REP(j, q) { if(Q.empty()) break; if(Q.top() >= Y[i]) return false; Q.pop(); } } return Q.empty(); }; if(!check(T)) return -1; int l = 1, r = T; while(l < r) { int m = (l + r) / 2; if(check(m)) r = m; else l = m + 1; } return l; }

Compilation message (stderr)

robots.cpp: In lambda function:
robots.cpp:21:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(cur < size(pts) && (i == A || pts[cur].fist < X[i]))
          ~~~~^~~~~~~~~~~
robots.cpp:21:49: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka struct std::pair<int, int>}' has no member named 'fist'; did you mean 'first'?
    while(cur < size(pts) && (i == A || pts[cur].fist < X[i]))
                                                 ^~~~
                                                 first