#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int const N = 2005;
int a[N], b[N];
int main(){
int n;
cin >> n;
for(int i = 0; i <= n; i++){
cin >> a[i];
}
for(int i = 0; i < n; i++){
cin >> b[i];
}
sort(b, b + n);
for(int i = 0; i <= n; i++){
vector<int> ad;
ad.reserve(n);
for(int j = 0; j <= n; j++){
if(i == j)
continue;
ad.push_back(a[j]);
}
sort(ad.begin(), ad.end());
int maxn = 0;
for(int j = 0; j < n; j++){
maxn = max(maxn, ad[j] - b[j]);
}
cout << maxn << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
292 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
292 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
204 KB |
Output is correct |
14 |
Correct |
24 ms |
332 KB |
Output is correct |
15 |
Correct |
79 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
152 ms |
352 KB |
Output is correct |
18 |
Correct |
106 ms |
340 KB |
Output is correct |
19 |
Correct |
101 ms |
336 KB |
Output is correct |
20 |
Correct |
98 ms |
340 KB |
Output is correct |
21 |
Correct |
128 ms |
464 KB |
Output is correct |
22 |
Correct |
105 ms |
336 KB |
Output is correct |
23 |
Correct |
100 ms |
332 KB |
Output is correct |
24 |
Correct |
103 ms |
452 KB |
Output is correct |
25 |
Correct |
150 ms |
468 KB |
Output is correct |
26 |
Correct |
151 ms |
340 KB |
Output is correct |
27 |
Correct |
140 ms |
332 KB |
Output is correct |
28 |
Correct |
145 ms |
332 KB |
Output is correct |
29 |
Correct |
112 ms |
448 KB |
Output is correct |
30 |
Correct |
145 ms |
332 KB |
Output is correct |
31 |
Correct |
158 ms |
328 KB |
Output is correct |
32 |
Correct |
168 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
292 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
204 KB |
Output is correct |
14 |
Correct |
24 ms |
332 KB |
Output is correct |
15 |
Correct |
79 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
152 ms |
352 KB |
Output is correct |
18 |
Correct |
106 ms |
340 KB |
Output is correct |
19 |
Correct |
101 ms |
336 KB |
Output is correct |
20 |
Correct |
98 ms |
340 KB |
Output is correct |
21 |
Correct |
128 ms |
464 KB |
Output is correct |
22 |
Correct |
105 ms |
336 KB |
Output is correct |
23 |
Correct |
100 ms |
332 KB |
Output is correct |
24 |
Correct |
103 ms |
452 KB |
Output is correct |
25 |
Correct |
150 ms |
468 KB |
Output is correct |
26 |
Correct |
151 ms |
340 KB |
Output is correct |
27 |
Correct |
140 ms |
332 KB |
Output is correct |
28 |
Correct |
145 ms |
332 KB |
Output is correct |
29 |
Correct |
112 ms |
448 KB |
Output is correct |
30 |
Correct |
145 ms |
332 KB |
Output is correct |
31 |
Correct |
158 ms |
328 KB |
Output is correct |
32 |
Correct |
168 ms |
452 KB |
Output is correct |
33 |
Runtime error |
2 ms |
436 KB |
Execution killed with signal 11 |
34 |
Halted |
0 ms |
0 KB |
- |