12
Item(int val, int r, int c) : val(val), r(r), c(c) {}16
bool operator()(const Item &it1, const Item &it2) {17
return it2.val < it1.val;23
vector<int> smallestRange(vector<vector<int>> &nums) {24
priority_queue<Item, vector<Item>, Comp> pq;26
int high = numeric_limits<int>::min();28
for (int i = 0; i < n; ++i) {29
pq.push(Item(nums[i][0], i, 0));30
high = max(high, nums[i][0]);32
int low = pq.top().val;34
vector<int> res{low, high};36
while (pq.size() == (size_t)n) {40
if ((size_t)it.c + 1 < nums[it.r].size()) {41
pq.push(Item(nums[it.r][it.c + 1], it.r, it.c + 1));42
high = max(high, nums[it.r][it.c + 1]);44
if (high - low < res[1] - res[0]) {