#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nemeshay ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define allr(pon) pon.rbegin(), pon.rend()
#define all(pon) pon.begin(), pon.end()
#define nosolve cout << "-1\n"
#define YES cout << "YES\n"
#define Yes cout << "Yes\n"
#define pii pair <int, int>
#define OK cout << "OK\n"
#define Ok cout << "Ok\n"
#define NO cout << "NO\n"
#define No cout << "No\n"
#define pf push_front
#define int long long
#define pb push_back
#define sigma signed
#define sc second
#define fr first
using namespace __gnu_pbds;
using namespace std;
const int N = 1e6 + 20, INF = 1e16 + 7;
int a[N], b[N];
sigma main(){
nemeshay
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++) {
int mx = 0;
vector <int> pon;
map <int, bool> nepon;
for (int j = 0; j <= n; j++) if (j != i) pon.pb(a[j]);
sort (pon.begin(), pon.end());
for (int j = 0; j < n; j++) mx = max(mx, pon[j] - b[j]);
cout << mx << ' ';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
468 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 |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
468 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 |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
15 ms |
524 KB |
Output is correct |
15 |
Correct |
49 ms |
556 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
88 ms |
572 KB |
Output is correct |
18 |
Correct |
62 ms |
348 KB |
Output is correct |
19 |
Correct |
74 ms |
556 KB |
Output is correct |
20 |
Correct |
61 ms |
348 KB |
Output is correct |
21 |
Correct |
67 ms |
344 KB |
Output is correct |
22 |
Correct |
61 ms |
556 KB |
Output is correct |
23 |
Correct |
66 ms |
552 KB |
Output is correct |
24 |
Correct |
70 ms |
344 KB |
Output is correct |
25 |
Correct |
103 ms |
348 KB |
Output is correct |
26 |
Correct |
89 ms |
556 KB |
Output is correct |
27 |
Correct |
87 ms |
348 KB |
Output is correct |
28 |
Correct |
96 ms |
348 KB |
Output is correct |
29 |
Correct |
70 ms |
344 KB |
Output is correct |
30 |
Correct |
84 ms |
544 KB |
Output is correct |
31 |
Correct |
103 ms |
348 KB |
Output is correct |
32 |
Correct |
115 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
468 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 |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
15 ms |
524 KB |
Output is correct |
15 |
Correct |
49 ms |
556 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
88 ms |
572 KB |
Output is correct |
18 |
Correct |
62 ms |
348 KB |
Output is correct |
19 |
Correct |
74 ms |
556 KB |
Output is correct |
20 |
Correct |
61 ms |
348 KB |
Output is correct |
21 |
Correct |
67 ms |
344 KB |
Output is correct |
22 |
Correct |
61 ms |
556 KB |
Output is correct |
23 |
Correct |
66 ms |
552 KB |
Output is correct |
24 |
Correct |
70 ms |
344 KB |
Output is correct |
25 |
Correct |
103 ms |
348 KB |
Output is correct |
26 |
Correct |
89 ms |
556 KB |
Output is correct |
27 |
Correct |
87 ms |
348 KB |
Output is correct |
28 |
Correct |
96 ms |
348 KB |
Output is correct |
29 |
Correct |
70 ms |
344 KB |
Output is correct |
30 |
Correct |
84 ms |
544 KB |
Output is correct |
31 |
Correct |
103 ms |
348 KB |
Output is correct |
32 |
Correct |
115 ms |
344 KB |
Output is correct |
33 |
Execution timed out |
1059 ms |
10680 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |