문제: 7785번: 회사에 있는 사람
basic-algo-lecture/workbook/0x15.md at master · encrypted-def/basic-algo-lecture
basic-algo-lecture/workbook/0x15.md at master · encrypted-def/basic-algo-lecture
바킹독의 실전 알고리즘 강의 자료. Contribute to encrypted-def/basic-algo-lecture development by creating an account on GitHub.
github.com
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_set>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
unordered_set<string> s;
int n;
cin >> n;
while (n-- > 0) {
string name, log;
cin >> name >> log;
if (log == "enter") {
s.insert(name);
}
else {
s.erase(name);
}
}
vector<string> ans(s.begin(), s.end());
sort(ans.begin(), ans.end(), greater<string>());
for (auto x : ans) {
cout << x << "\n";
}
return 0;
}
음. 그냥 unordered_set stl 사용법만 알고 있으면 쉽게 해결할 수 있는 문제..