Fourteen problems about bundled values. Read each record into a pair or a
struct and keep it whole; no problem here needs sorting yet.
- Even Pairs, Top Students, Reflected Points, Swap Coordinates: read
pairs, test or transform each one, print it. Coordinates go up to 10⁹ in size,
and Swap Coordinates reaches ±2³¹, so read them as
long long. - Highest and Lowest Score: the Week 4 maximum and minimum loops, each keeping
an index; the strict
>and<keep the first of equal scores. - Best Student: ties on the score go to the lexicographically smaller name.
Compare
{score, name}pairs — or, since a larger score must win,{-score, name}pairs with<. - Student Cards, Athlete Summaries, Contest Totals: a struct per record, read and printed back with something computed. Up to 3·10⁵ lines: keep the fast-IO lines.
- Most Valuable Product and Largest Rectangle:
price * quantityandw * hreach 10¹⁸, so the fields arelong longbefore multiplying. - Point Distance: a
struct Pointand q queries; the squared distance also needslong long. - Intervals Length and Coverage: one struct, two answers (a total and a count) from a single loop.
- Library Borrow Records: a
Memberstruct with avector<int>of borrowed book indices inside it — a field can be a vector.