blob: 75c0e15d9d98392c3590eef2dc1c1549711aee1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "leetcode.h"
class Solution {
public:
vvd(int) findWinners(vvd(int) & matches) {
map<int, int> lost;
for (auto m : matches) {
if (!lost.count(m[0]))
lost[m[0]] = 0;
lost[m[1]]++;
}
vector<int> zero, ones;
for (auto [k, l] : lost) {
if (l == 0)
zero.push_back(k);
if (l == 1)
ones.push_back(k);
}
return {zero, ones};
}
};
|