Submission #865314

# Submission time Handle Problem Language Result Execution time Memory
865314 2023-10-24T07:22:35 Z Trisanu_Das Lightning Rod (NOI18_lightningrod) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n; cin >> n;
  set<pair<int, int> > s;
  for(int i = 0; i < n; i++){
    int x, y; cin >> x >> y;
    s.insert({y, x});
  }
  int ans = 0;
  while(!s.empty()){
    pair<int, int> a = *s.rbegin();
    vector<pair<int, int> > v;
    for(auto i : s) if(abs(a.ss - i.ss) <= a.ff - i.ff) v.push_back(i);
    for(auto i : v) s.erase(i);
  }
  cout << ans << '\n';
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:15:30: error: 'struct std::pair<int, int>' has no member named 'ss'
   15 |     for(auto i : s) if(abs(a.ss - i.ss) <= a.ff - i.ff) v.push_back(i);
      |                              ^~
lightningrod.cpp:15:37: error: 'struct std::pair<int, int>' has no member named 'ss'
   15 |     for(auto i : s) if(abs(a.ss - i.ss) <= a.ff - i.ff) v.push_back(i);
      |                                     ^~
lightningrod.cpp:15:46: error: 'struct std::pair<int, int>' has no member named 'ff'
   15 |     for(auto i : s) if(abs(a.ss - i.ss) <= a.ff - i.ff) v.push_back(i);
      |                                              ^~
lightningrod.cpp:15:53: error: 'struct std::pair<int, int>' has no member named 'ff'
   15 |     for(auto i : s) if(abs(a.ss - i.ss) <= a.ff - i.ff) v.push_back(i);
      |                                                     ^~