addict_0x0F's blog

By addict_0x0F, history, 3 weeks ago, In English

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;

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I know it is hard to believe, but for whatever reason they have decided, std::data is a thing and the names have collided, so std::set took std::data over your class. Changing the class name to something else (e.g. Data) makes it work.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Never Thought that std::data exists. Thank you so much. I think I should debug more before posting it.