Submission #865380

#TimeUsernameProblemLanguageResultExecution timeMemory
865380Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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});
      |                               ^~