#include <bits/stdc++.h>
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define sts stable_sort
using namespace std;
const int MAXN = 1e6 + 4;
const int MOD = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<ll> v(n + 1);
vector<ll> asd(n + 1);
vector<ll> b(n);
for(int i = 0; i <= n; i++){
cin >> v[i];
asd[i] = v[i];
}
sts(v.B, v.E);
for(int i = 0; i < n; i++){
cin >> b[i];
}
sts(b.B, b.E);
vector<ll> ans;
for(int i = 0; i <= n; i++){
ll aux = asd[i], maxi = 0;
int j = 0;
for(int i = 0; i <= n; i++){
if(v[i] == aux)continue;
else{
ll x = v[i] - b[j];
if(x > 0){
maxi = max(maxi, x);
}
j++;
}
}
ans.pb(maxi);
}
for(auto &x : ans){
cout << x << " ";
}cout << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 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 |
324 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 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 |
324 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
8 ms |
392 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
9 ms |
332 KB |
Output is correct |
18 |
Correct |
9 ms |
332 KB |
Output is correct |
19 |
Correct |
10 ms |
340 KB |
Output is correct |
20 |
Correct |
10 ms |
388 KB |
Output is correct |
21 |
Correct |
11 ms |
332 KB |
Output is correct |
22 |
Correct |
10 ms |
340 KB |
Output is correct |
23 |
Correct |
6 ms |
340 KB |
Output is correct |
24 |
Correct |
6 ms |
404 KB |
Output is correct |
25 |
Correct |
10 ms |
424 KB |
Output is correct |
26 |
Correct |
8 ms |
340 KB |
Output is correct |
27 |
Correct |
8 ms |
332 KB |
Output is correct |
28 |
Correct |
9 ms |
340 KB |
Output is correct |
29 |
Correct |
6 ms |
388 KB |
Output is correct |
30 |
Correct |
8 ms |
400 KB |
Output is correct |
31 |
Correct |
12 ms |
424 KB |
Output is correct |
32 |
Correct |
10 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 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 |
324 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
8 ms |
392 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
9 ms |
332 KB |
Output is correct |
18 |
Correct |
9 ms |
332 KB |
Output is correct |
19 |
Correct |
10 ms |
340 KB |
Output is correct |
20 |
Correct |
10 ms |
388 KB |
Output is correct |
21 |
Correct |
11 ms |
332 KB |
Output is correct |
22 |
Correct |
10 ms |
340 KB |
Output is correct |
23 |
Correct |
6 ms |
340 KB |
Output is correct |
24 |
Correct |
6 ms |
404 KB |
Output is correct |
25 |
Correct |
10 ms |
424 KB |
Output is correct |
26 |
Correct |
8 ms |
340 KB |
Output is correct |
27 |
Correct |
8 ms |
332 KB |
Output is correct |
28 |
Correct |
9 ms |
340 KB |
Output is correct |
29 |
Correct |
6 ms |
388 KB |
Output is correct |
30 |
Correct |
8 ms |
400 KB |
Output is correct |
31 |
Correct |
12 ms |
424 KB |
Output is correct |
32 |
Correct |
10 ms |
332 KB |
Output is correct |
33 |
Execution timed out |
1071 ms |
9140 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |