0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#3499. 「联合省选 2021 A | B」卡牌游戏

https://loj.ac/s/1337644
This commit is contained in:
Baoshuo Ren 2022-01-05 19:36:29 +08:00
parent 7a5650639f
commit a21419cfbb
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

28
LibreOJ/3499/3499.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <iostream>
#include <limits>
using std::cin;
using std::cout;
using std::endl;
const int N = 1000005;
int n, m, a[N], b[N];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
cin >> b[i];
}
int min = std::numeric_limits<int>::max(),
max = std::numeric_limits<int>::min();
for (int i = 1; i <= n; i++) {
min = std::min(min, std::max(a[i], b[i]));
max = std::max(max, std::min(a[i], b[i]));
}
cout << max - min << endl;
return 0;
}