Skip to content

Commit

Permalink
Add 04307.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Feb 3, 2024
1 parent 70fd15b commit be585f9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 04xxx/04307.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <algorithm>
#include <iostream>
using namespace std;

void solve(void) {
int l, n; cin >> l >> n;

int a = 0, b = 0;
for (int i=0; i<n; i++) {
int ant; cin >> ant;
a = max(a, min(ant, l-ant));
b = max(b, max(ant, l-ant));
}
cout << a << " " << b << "\n";
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

int t; cin >> t;
while (t--) solve();
return 0;
}

0 comments on commit be585f9

Please sign in to comment.