Another late start for me, though at least I had the exucse of being out of the house most of the evening today. I know I'll have to keep playing catch-up when I'm traveling next week anyway, but I'd rather try to keep at it every evening on-time, at least for a little while.
So far, it involves cleaning assignments, but on a more basic level, it seems like a classic scheduling problem? I remember doing an assignment way back my freshman year of college, there was a similar problem of trying to automatically figure out class scheduling given a list of courses. It seems pretty similar.
Since it's only figuring out if, in a pair, one assignment fully contains the other. Easy enough to break down into "Does A fully fit into B? Does B fully fit into A?". Each of those is easy enough to solve, so looking for both should be easy.
pair<int, int> left, right;
// Check if Left is contained in Right
if (left.first >= right.first && left.second <= right.second) { count++; continue;}
if (right.first >= left.first && right.second <= left.second) { count++; continue;}
Okay, easy enough condition checking, even if slightly more complicated. Just add extra checks after the 'wholly overlap' checks to see which overlap at all. I can probably do it without the 'wholly contained' checks, but I don't think it'll matter with these input sizes.
if (left.first >= right.first && left.first <= right.second) { count++; continue; }
if (left.second >= right.first && left.second <= right.second) { count++; continue; }
if (right.first >= left.first && right.first <= left.second) { count++; continue; }
if (right.second >= left.first && right.second <= left.second) { count++; continue; }
Easy enough. Though it's still the first week.