https://www.acmicpc.net/problem/7785
#include <bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
using namespace std;
void CPP_INIT() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
bool compare(string a, string b) {
return a > b;
}
int main(void) {
CPP_INIT();
int input;
string str, str2;
unordered_map<string, string> um;
vector<string> v;
cin >> input;
for (int i = 0; i < input; i++) {
cin >> str >> str2;
um[str] = str2;
v.push_back(str);
}
sort(v.begin(), v.end(), compare);
v.erase(unique(v.begin(), v.end()), v.end());
for (int i = 0; i < v.size(); i++) {
if (um[v[i]] == "enter") cout << v[i] << endl;
}
}
'알고리즘' 카테고리의 다른 글
C++ 알고리즘 - 백준 11478 서로 다른 부분 문자열의 개수 (0) | 2025.01.11 |
---|---|
C++ 알고리즘 - 백준 1269 대칭 차집합 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 14425 문자열 집합 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 10815 숫자 카드 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 19532 수학은 비대면강의입니다 (연립방정식 해 찾기) (0) | 2025.01.11 |