Submission #865380

# Submission time Handle Problem Language Result Execution time Memory
865380 2023-10-24T07:47:41 Z Trisanu_Das Lightning Rod (NOI18_lightningrod) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
int n;
stack<pair<int, int> > s;
 
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) { 
      int x, y; cin >> x >> y;
      int mx = x + y, mn = x - y;
      while(!s.empty() && s.top().ff >= mn) s.pop();
      if(s.empty() || s.top().ss < mx) s.push({mn, mx});
	}
	cout << s.size() << '\n';
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:12:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ff'
   12 |       while(!s.empty() && s.top().ff >= mn) s.pop();
      |                                   ^~
lightningrod.cpp:13:31: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ss'
   13 |       if(s.empty() || s.top().ss < mx) s.push({mn, mx});
      |                               ^~