#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll unsigned long long
#define MAX 200005
using namespace std;
int n, A[MAX], B[MAX], ans;
set<int> ASet;
void solve() {
cin >> n;
for (int i = 0; i <= n; i++) {
cin >> A[i];
ASet.insert(A[i]);
}
for (int i = 0; i < n; i++) cin >> B[i];
sort(B, B + n);
for (int i = 0; i <= n; i++) {
ans = 0;
ASet.erase(A[i]);
int j = 0;
for (auto it : ASet) {
ans = max(ans, max(0, it - B[j]));
j++;
}
cout << ans << " ";
ASet.insert(A[i]);
}
}
int main() {
FastIO
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
6 ms |
396 KB |
Output is correct |
15 |
Correct |
18 ms |
444 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
31 ms |
472 KB |
Output is correct |
18 |
Correct |
21 ms |
404 KB |
Output is correct |
19 |
Correct |
23 ms |
340 KB |
Output is correct |
20 |
Correct |
22 ms |
340 KB |
Output is correct |
21 |
Correct |
24 ms |
444 KB |
Output is correct |
22 |
Correct |
22 ms |
452 KB |
Output is correct |
23 |
Correct |
22 ms |
436 KB |
Output is correct |
24 |
Correct |
23 ms |
452 KB |
Output is correct |
25 |
Correct |
36 ms |
472 KB |
Output is correct |
26 |
Correct |
29 ms |
468 KB |
Output is correct |
27 |
Correct |
30 ms |
468 KB |
Output is correct |
28 |
Correct |
32 ms |
464 KB |
Output is correct |
29 |
Correct |
24 ms |
452 KB |
Output is correct |
30 |
Correct |
30 ms |
468 KB |
Output is correct |
31 |
Correct |
34 ms |
340 KB |
Output is correct |
32 |
Correct |
37 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
6 ms |
396 KB |
Output is correct |
15 |
Correct |
18 ms |
444 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
31 ms |
472 KB |
Output is correct |
18 |
Correct |
21 ms |
404 KB |
Output is correct |
19 |
Correct |
23 ms |
340 KB |
Output is correct |
20 |
Correct |
22 ms |
340 KB |
Output is correct |
21 |
Correct |
24 ms |
444 KB |
Output is correct |
22 |
Correct |
22 ms |
452 KB |
Output is correct |
23 |
Correct |
22 ms |
436 KB |
Output is correct |
24 |
Correct |
23 ms |
452 KB |
Output is correct |
25 |
Correct |
36 ms |
472 KB |
Output is correct |
26 |
Correct |
29 ms |
468 KB |
Output is correct |
27 |
Correct |
30 ms |
468 KB |
Output is correct |
28 |
Correct |
32 ms |
464 KB |
Output is correct |
29 |
Correct |
24 ms |
452 KB |
Output is correct |
30 |
Correct |
30 ms |
468 KB |
Output is correct |
31 |
Correct |
34 ms |
340 KB |
Output is correct |
32 |
Correct |
37 ms |
468 KB |
Output is correct |
33 |
Execution timed out |
1043 ms |
11652 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |