#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=2e5+5;
vector<int>b;
int a[N];
void fun(vector<int>v){
sort(v.begin(),v.end());
int n=b.size();
int s=0;
for(int i=0;i<n;i++){
s=max(s,v[i]-b[i]);
}
cout<<s<<" ";
}
signed main(){
int n;
cin>>n;
for(int i=1;i<=n+1;i++)cin>>a[i];
for(int i=1;i<=n;i++){
int a;
cin>>a;
b.pb(a);
}
sort(b.begin(),b.end());
for(int i=1;i<=n+1;i++){
vector<int>vc;
for(int j=1;j<=n+1;j++){
if(i==j)continue;
vc.pb(a[j]);
}
fun(vc);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
444 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
444 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 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 |
22 ms |
344 KB |
Output is correct |
15 |
Correct |
72 ms |
520 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
140 ms |
540 KB |
Output is correct |
18 |
Correct |
89 ms |
344 KB |
Output is correct |
19 |
Correct |
98 ms |
348 KB |
Output is correct |
20 |
Correct |
91 ms |
348 KB |
Output is correct |
21 |
Correct |
100 ms |
520 KB |
Output is correct |
22 |
Correct |
89 ms |
528 KB |
Output is correct |
23 |
Correct |
92 ms |
520 KB |
Output is correct |
24 |
Correct |
103 ms |
524 KB |
Output is correct |
25 |
Correct |
138 ms |
348 KB |
Output is correct |
26 |
Correct |
130 ms |
348 KB |
Output is correct |
27 |
Correct |
122 ms |
344 KB |
Output is correct |
28 |
Correct |
136 ms |
348 KB |
Output is correct |
29 |
Correct |
106 ms |
520 KB |
Output is correct |
30 |
Correct |
123 ms |
516 KB |
Output is correct |
31 |
Correct |
169 ms |
600 KB |
Output is correct |
32 |
Correct |
160 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
444 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 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 |
22 ms |
344 KB |
Output is correct |
15 |
Correct |
72 ms |
520 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
140 ms |
540 KB |
Output is correct |
18 |
Correct |
89 ms |
344 KB |
Output is correct |
19 |
Correct |
98 ms |
348 KB |
Output is correct |
20 |
Correct |
91 ms |
348 KB |
Output is correct |
21 |
Correct |
100 ms |
520 KB |
Output is correct |
22 |
Correct |
89 ms |
528 KB |
Output is correct |
23 |
Correct |
92 ms |
520 KB |
Output is correct |
24 |
Correct |
103 ms |
524 KB |
Output is correct |
25 |
Correct |
138 ms |
348 KB |
Output is correct |
26 |
Correct |
130 ms |
348 KB |
Output is correct |
27 |
Correct |
122 ms |
344 KB |
Output is correct |
28 |
Correct |
136 ms |
348 KB |
Output is correct |
29 |
Correct |
106 ms |
520 KB |
Output is correct |
30 |
Correct |
123 ms |
516 KB |
Output is correct |
31 |
Correct |
169 ms |
600 KB |
Output is correct |
32 |
Correct |
160 ms |
348 KB |
Output is correct |
33 |
Execution timed out |
1038 ms |
10972 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |