Need help implementing sweep line

struct event {
int y, t, i;
bool operator<(const event &o) const {
return make_pair(y, t)<make_pair(o.y, o.t);
}
};
and then.
for(int i=0; i+1<n; ++i) {
//add segment
ve.push_back({min(a[i], a[i+1]), 1, i});
//remove segment
ve.push_back({max(a[i], a[i+1]), 3, i});
}

what process struct event is doing…

also problem is https://www.codechef.com/LRNDSA09/problems/LAZER/ from dsa learnig session
and also the solution from where i am trying to learn sweep line (DRYrun ) https://www.codechef.com/viewsolution/30509307