Custom Set comparator for Struct

Правка en1, от addict_0x0F, 2024-06-21 08:44:23

I have been trying to solve this Problem F. Here i am using set of custom data as below

struct data{
    ll x,y;
    int n;
    bool operator()(const data& a, const data& b){
        return (a.x==b.x)?(a.y<b.y):(a.x<b.x);
    }
    friend bool operator < (const data& a, const data& b){
        return (a.x==b.x)?(a.y<b.y):(a.x<b.x);
    }
    friend bool operator > (const data& a, const data& b){
        return (a.x==b.x)?(a.y>b.y):(a.x>b.x);
    }
};
set<data> st;

I am doing Insert, erase, lower_bound operation on this set. which is working fine on my Ubantu, but giving compilation error as "template argument 1 is invalid". The problem is in the set data structure so tried to debug it from this stackoverflow thread,tried to subit it in different c++ virsions too,but none of them is working,(some of it are working fine on my machine, but not on atcoder judge.

My submissions one. and another implementation of set::comp()

HELP Thanks in Advance;

Теги c++, set, custom comparator, struct

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский addict_0x0F 2024-06-21 08:44:23 1282 Initial revision (published)