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

P7514 [省选联考 2021 A/B 卷] 卡牌游戏

R65969728
This commit is contained in:
Baoshuo Ren 2021-12-29 16:11:19 +08:00
parent fcadb28e33
commit fc158b5ece
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

28
Luogu/P7514/P7514.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;
}