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

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

If we have struct like this:

struct Example{
    int first, second;
    bool operator<(const Example &another) const {
        if(first==another.first)return second>another.second;
        return first>another.first;
    }
};

In other words, struct which has two integer variables first, second. Same as standard pair<int, int> variable but is difference in how will it be sorted in some data structure (vector, map...)

Could there be increase in TC if we talk about sorting when inserting simpler variables inside of maps, sets etc.? (simple variables — where the code inside operator would be O(1). Like in the example).

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