제출 #865350

#제출 시각아이디문제언어결과실행 시간메모리
865350Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int dp[10000005], n, mx; stack<int> s; int main(){ cin >> n; for(int i = 0; i < n; i++){ int x, y; cin >> x >> y; if(i == 0){ mx = x + y; s.push_back(x - y); }else if(mx < x + y){ while(!s.empty() && s.top() >= (x - y)) s.pop(); s.push(x - y); mx = x + y; } cout << s.size() << '\n'; } }

컴파일 시 표준 에러 (stderr) 메시지

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:13:9: error: 'class std::stack<int>' has no member named 'push_back'
   13 |       s.push_back(x - y);
      |         ^~~~~~~~~