Skip to content

Commit a35783b

Browse files
authored
[2002] 추월
1 parent 69f1c2c commit a35783b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Baekjoon/hyeonyoung/추월.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// 221229_BOJ_2002
2+
3+
#include <iostream>
4+
#include <string>
5+
#include <vector>
6+
#include <map>
7+
8+
using namespace std;
9+
10+
int N, answer = 0;
11+
vector<string> E;
12+
map<string, int> S;
13+
14+
int main()
15+
{
16+
ios::sync_with_stdio(0);
17+
cin.tie(0);
18+
19+
cin >> N;
20+
for (int i = 0; i < N; ++i)
21+
{
22+
string str;
23+
cin >> str;
24+
S[str] = i;
25+
}
26+
for (int i = 0; i < N; ++i)
27+
{
28+
string str;
29+
cin >> str;
30+
E.push_back(str);
31+
}
32+
33+
for (int i = 0; i < N; ++i)
34+
{
35+
for (int j = i + 1; j < N; ++j)
36+
{
37+
if (S[E[i]] > S[E[j]])
38+
{
39+
answer++;
40+
break;
41+
}
42+
}
43+
}
44+
cout << answer;
45+
46+
return 0;
47+
}

0 commit comments

Comments
 (0)