Submission #865314

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

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