#include "bits/stdc++.h"
using namespace std;
void fast() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}
void ran() {
srand(chrono::steady_clock::now().time_since_epoch().count());
}
long long get_rand() {
long long a = rand();
long long b = rand();
return a * (RAND_MAX + 1ll) + b;
}
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;
signed main() {
ran(); fast();
int n;
cin >> n;
int a[n+1], b[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> t;
for (int j=0; j<=n; j++) {
if (j != i) {
t.push_back(a[j]);
}
}
sort(t.begin(), t.end());
int f = 0;
for (int j=0; j<n; j++) {
f = max(f, max(t[j] - b[j], 0));
}
cout << f << ' ';
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
304 KB |
Output is correct |
14 |
Correct |
34 ms |
384 KB |
Output is correct |
15 |
Correct |
98 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
161 ms |
384 KB |
Output is correct |
18 |
Correct |
119 ms |
632 KB |
Output is correct |
19 |
Correct |
123 ms |
384 KB |
Output is correct |
20 |
Correct |
121 ms |
512 KB |
Output is correct |
21 |
Correct |
126 ms |
476 KB |
Output is correct |
22 |
Correct |
122 ms |
384 KB |
Output is correct |
23 |
Correct |
124 ms |
504 KB |
Output is correct |
24 |
Correct |
127 ms |
384 KB |
Output is correct |
25 |
Correct |
181 ms |
584 KB |
Output is correct |
26 |
Correct |
166 ms |
504 KB |
Output is correct |
27 |
Correct |
162 ms |
384 KB |
Output is correct |
28 |
Correct |
187 ms |
384 KB |
Output is correct |
29 |
Correct |
132 ms |
504 KB |
Output is correct |
30 |
Correct |
162 ms |
504 KB |
Output is correct |
31 |
Correct |
186 ms |
384 KB |
Output is correct |
32 |
Correct |
207 ms |
636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
304 KB |
Output is correct |
14 |
Correct |
34 ms |
384 KB |
Output is correct |
15 |
Correct |
98 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
161 ms |
384 KB |
Output is correct |
18 |
Correct |
119 ms |
632 KB |
Output is correct |
19 |
Correct |
123 ms |
384 KB |
Output is correct |
20 |
Correct |
121 ms |
512 KB |
Output is correct |
21 |
Correct |
126 ms |
476 KB |
Output is correct |
22 |
Correct |
122 ms |
384 KB |
Output is correct |
23 |
Correct |
124 ms |
504 KB |
Output is correct |
24 |
Correct |
127 ms |
384 KB |
Output is correct |
25 |
Correct |
181 ms |
584 KB |
Output is correct |
26 |
Correct |
166 ms |
504 KB |
Output is correct |
27 |
Correct |
162 ms |
384 KB |
Output is correct |
28 |
Correct |
187 ms |
384 KB |
Output is correct |
29 |
Correct |
132 ms |
504 KB |
Output is correct |
30 |
Correct |
162 ms |
504 KB |
Output is correct |
31 |
Correct |
186 ms |
384 KB |
Output is correct |
32 |
Correct |
207 ms |
636 KB |
Output is correct |
33 |
Execution timed out |
1090 ms |
7476 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |