#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n + 1), b(n);
for (int i = 0; i < n + 1; i++) {
cin >> a[i];
}
for (int j = 0; j < n; j++) {
cin >> b[j];
}
sort(b.begin(), b.end());
vector<int> ans;
for (int i = 0; i < n + 1; i++) {
vector <int> v;
for(int j = 0 ; j < n + 1; j++){
if(i == j){
continue;
}
else{
v.push_back(a[j]);
}
}
sort(v.begin() , v.end());
int mn = 0;
for(int j = 0 ; j < n; j++){
mn = max(mn , v[j] - b[j]);
}
ans.push_back(mn);
}
for(auto x : ans){
cout << x << " ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
14 ms |
484 KB |
Output is correct |
15 |
Correct |
48 ms |
516 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
85 ms |
536 KB |
Output is correct |
18 |
Correct |
61 ms |
344 KB |
Output is correct |
19 |
Correct |
68 ms |
344 KB |
Output is correct |
20 |
Correct |
59 ms |
348 KB |
Output is correct |
21 |
Correct |
65 ms |
504 KB |
Output is correct |
22 |
Correct |
60 ms |
520 KB |
Output is correct |
23 |
Correct |
65 ms |
488 KB |
Output is correct |
24 |
Correct |
72 ms |
348 KB |
Output is correct |
25 |
Correct |
95 ms |
540 KB |
Output is correct |
26 |
Correct |
87 ms |
348 KB |
Output is correct |
27 |
Correct |
84 ms |
532 KB |
Output is correct |
28 |
Correct |
94 ms |
344 KB |
Output is correct |
29 |
Correct |
68 ms |
520 KB |
Output is correct |
30 |
Correct |
89 ms |
344 KB |
Output is correct |
31 |
Correct |
101 ms |
348 KB |
Output is correct |
32 |
Correct |
114 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
14 ms |
484 KB |
Output is correct |
15 |
Correct |
48 ms |
516 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
85 ms |
536 KB |
Output is correct |
18 |
Correct |
61 ms |
344 KB |
Output is correct |
19 |
Correct |
68 ms |
344 KB |
Output is correct |
20 |
Correct |
59 ms |
348 KB |
Output is correct |
21 |
Correct |
65 ms |
504 KB |
Output is correct |
22 |
Correct |
60 ms |
520 KB |
Output is correct |
23 |
Correct |
65 ms |
488 KB |
Output is correct |
24 |
Correct |
72 ms |
348 KB |
Output is correct |
25 |
Correct |
95 ms |
540 KB |
Output is correct |
26 |
Correct |
87 ms |
348 KB |
Output is correct |
27 |
Correct |
84 ms |
532 KB |
Output is correct |
28 |
Correct |
94 ms |
344 KB |
Output is correct |
29 |
Correct |
68 ms |
520 KB |
Output is correct |
30 |
Correct |
89 ms |
344 KB |
Output is correct |
31 |
Correct |
101 ms |
348 KB |
Output is correct |
32 |
Correct |
114 ms |
512 KB |
Output is correct |
33 |
Execution timed out |
1022 ms |
10640 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |