Блог пользователя addict_0x0F

Автор addict_0x0F, история, 5 месяцев назад, По-английски

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;

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    5 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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