forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjudging.cpp
44 lines (37 loc) · 854 Bytes
/
judging.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> dom;
vector<string> kattis;
for(int i = 0; i < n; i++) {
string temp;
cin >> temp;
dom.push_back(temp);
}
for(int i = 0; i < n; i++) {
string temp;
cin >> temp;
kattis.push_back(temp);
}
sort(dom.begin(), dom.end());
sort(kattis.begin(), kattis.end());
int matches = 0;
while(dom.size() > 0 && kattis.size() > 0) {
if(kattis.back() == dom.back()) {
dom.pop_back();
kattis.pop_back();
matches++;
}
else if(kattis.back() < dom.back()) {
dom.pop_back();
}
else {
kattis.pop_back();
}
}
cout << matches << endl;
}