#include <bits/stdc++.h>
using namespace std;
int 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 i = 0; i < n; i++)
cin >> b[i];
sort(b.begin(), b.end());
vector <int> a2 = a;
sort(a2.begin(), a2.end());
for (int i = 0; i < n+1; i++) {
int mx = 0;
bool skipped = false;
for (int j = 0, id = 0; j < n+1; j++) {
if (!skipped && a[i] == a2[j]) {
skipped = true;
continue;
}
mx = max(mx, a2[j] - b[id]);
id++;
}
cout << mx << ' ';
}
cout << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
436 KB |
Output is correct |
4 |
Correct |
1 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
380 KB |
Output is correct |
12 |
Correct |
1 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
436 KB |
Output is correct |
4 |
Correct |
1 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
380 KB |
Output is correct |
12 |
Correct |
1 ms |
508 KB |
Output is correct |
13 |
Correct |
1 ms |
508 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
5 ms |
336 KB |
Output is correct |
18 |
Correct |
4 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
336 KB |
Output is correct |
21 |
Correct |
4 ms |
336 KB |
Output is correct |
22 |
Correct |
5 ms |
336 KB |
Output is correct |
23 |
Correct |
4 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
604 KB |
Output is correct |
25 |
Correct |
5 ms |
336 KB |
Output is correct |
26 |
Correct |
5 ms |
336 KB |
Output is correct |
27 |
Correct |
5 ms |
504 KB |
Output is correct |
28 |
Correct |
5 ms |
336 KB |
Output is correct |
29 |
Correct |
5 ms |
336 KB |
Output is correct |
30 |
Correct |
4 ms |
336 KB |
Output is correct |
31 |
Correct |
6 ms |
652 KB |
Output is correct |
32 |
Correct |
6 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
436 KB |
Output is correct |
4 |
Correct |
1 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
380 KB |
Output is correct |
12 |
Correct |
1 ms |
508 KB |
Output is correct |
13 |
Correct |
1 ms |
508 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
5 ms |
336 KB |
Output is correct |
18 |
Correct |
4 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
336 KB |
Output is correct |
21 |
Correct |
4 ms |
336 KB |
Output is correct |
22 |
Correct |
5 ms |
336 KB |
Output is correct |
23 |
Correct |
4 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
604 KB |
Output is correct |
25 |
Correct |
5 ms |
336 KB |
Output is correct |
26 |
Correct |
5 ms |
336 KB |
Output is correct |
27 |
Correct |
5 ms |
504 KB |
Output is correct |
28 |
Correct |
5 ms |
336 KB |
Output is correct |
29 |
Correct |
5 ms |
336 KB |
Output is correct |
30 |
Correct |
4 ms |
336 KB |
Output is correct |
31 |
Correct |
6 ms |
652 KB |
Output is correct |
32 |
Correct |
6 ms |
336 KB |
Output is correct |
33 |
Execution timed out |
1043 ms |
6216 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |