0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 23:58:48 +00:00

B - Hit and Blow

https://atcoder.jp/contests/abc243/submissions/30043462
This commit is contained in:
Baoshuo Ren 2022-03-12 20:20:18 +08:00
parent 05abb87d52
commit 126dfda591
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

34
AtCoder/ABC243/B/B.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <algorithm>
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1005;
int n, a[N], b[N], ans1, ans2;
int main() {
std::ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
cin >> b[i];
}
for (int i = 1; i <= n; i++) {
ans1 += a[i] == b[i];
}
std::sort(a + 1, a + 1 + n);
std::sort(b + 1, b + 1 + n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (a[i] == b[j]) ans2++;
}
}
cout << ans1 << endl
<< ans2 - ans1 << endl;
return 0;
}