제출 #123768

#제출 시각아이디문제언어결과실행 시간메모리
123768MAMBA로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 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], w[MAXN]; priority_queue<int, array<int , MAXN>> st; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { iota(a , a + T , 0); rep(i , 0 , T) w[i]= W[i]; sort(a , a + T, [](int l , int r) { return w[l] < w[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; while (st.size()) st.pop(); int ptr = 0; rep(i , 0 , A) { while (ptr < T && W[a[ptr]] < X[i]) st.push(S[a[ptr++]]); rep(j , 0 , mid) if (st.size()) st.pop(); } while (ptr < T) st.push(S[a[ptr++]]); rep(i , 0 ,B) rep(j , 0 , mid) if (st.size() && st.top() < Y[i]) st.pop(); if (st.empty()) hi = mid; else lo = mid; } if (hi == T + 1) hi = -1; return hi; }

컴파일 시 표준 에러 (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;
             ~~~^~~~
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from robots.cpp:1:
/usr/include/c++/7/bits/stl_queue.h: In instantiation of 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = int; _Sequence = std::array<int, 1000010>; _Compare = std::less<int>]':
robots.cpp:28:28:   required from here
/usr/include/c++/7/bits/stl_queue.h:634:4: error: 'struct std::array<int, 1000010>' has no member named 'pop_back'; did you mean 'back'?
  c.pop_back();
  ~~^~~~~~~~
  back
/usr/include/c++/7/bits/stl_queue.h: In instantiation of 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = int; _Sequence = std::array<int, 1000010>; _Compare = std::less<int>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = int]':
robots.cpp:32:24:   required from here
/usr/include/c++/7/bits/stl_queue.h:597:4: error: 'struct std::array<int, 1000010>' has no member named 'push_back'
  c.push_back(__x);
  ~~^~~~~~~~~