#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,k,odd,index;
cin >> n;
vector<pair<int,int>>dostepne_szyje;
vector<int>jakie_maja_ludzie;
for(int i=0;i<n+1;++i){
cin >> k;
dostepne_szyje.push_back({k,i+1});
}
sort(dostepne_szyje.begin(),dostepne_szyje.end());
for(int i=0;i<n;++i){
cin >> k;
jakie_maja_ludzie.push_back(k);
}
sort(jakie_maja_ludzie.begin(),jakie_maja_ludzie.end());
for(int i=1;i<n+2;++i){
odd=0;
index=0;
for(int j=0;j<n+1;++j){
if(dostepne_szyje[j].second==i) continue;
odd=max(odd,dostepne_szyje[j].first-jakie_maja_ludzie[index]);
index++;
}
cout << odd << ' ';
}
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
504 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
2 ms |
336 KB |
Output is correct |
15 |
Correct |
3 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
5 ms |
336 KB |
Output is correct |
18 |
Correct |
4 ms |
504 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
336 KB |
Output is correct |
21 |
Correct |
4 ms |
336 KB |
Output is correct |
22 |
Correct |
4 ms |
336 KB |
Output is correct |
23 |
Correct |
4 ms |
496 KB |
Output is correct |
24 |
Correct |
4 ms |
504 KB |
Output is correct |
25 |
Correct |
5 ms |
348 KB |
Output is correct |
26 |
Correct |
4 ms |
336 KB |
Output is correct |
27 |
Correct |
5 ms |
336 KB |
Output is correct |
28 |
Correct |
5 ms |
336 KB |
Output is correct |
29 |
Correct |
6 ms |
336 KB |
Output is correct |
30 |
Correct |
4 ms |
336 KB |
Output is correct |
31 |
Correct |
5 ms |
336 KB |
Output is correct |
32 |
Correct |
5 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
504 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
2 ms |
336 KB |
Output is correct |
15 |
Correct |
3 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
5 ms |
336 KB |
Output is correct |
18 |
Correct |
4 ms |
504 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
336 KB |
Output is correct |
21 |
Correct |
4 ms |
336 KB |
Output is correct |
22 |
Correct |
4 ms |
336 KB |
Output is correct |
23 |
Correct |
4 ms |
496 KB |
Output is correct |
24 |
Correct |
4 ms |
504 KB |
Output is correct |
25 |
Correct |
5 ms |
348 KB |
Output is correct |
26 |
Correct |
4 ms |
336 KB |
Output is correct |
27 |
Correct |
5 ms |
336 KB |
Output is correct |
28 |
Correct |
5 ms |
336 KB |
Output is correct |
29 |
Correct |
6 ms |
336 KB |
Output is correct |
30 |
Correct |
4 ms |
336 KB |
Output is correct |
31 |
Correct |
5 ms |
336 KB |
Output is correct |
32 |
Correct |
5 ms |
336 KB |
Output is correct |
33 |
Execution timed out |
1067 ms |
4312 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |