提交时间:2024-01-21 14:52:45
运行 ID: 121025
#include <bits/stdc++.h> using namespace std; int main(){ int n, l; cin >> n >> l; int x = 0, y = 0; l++; for(int i = 1; i <= n; i++){ int xy; cin >> xy; x = max(x, min(xy, l - xy)); y = max(y, max(xy, l - xy)); } cout << x << " " << y; return 0; }