#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[200005],b[200005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n+1;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
cin>>b[i];
sort(b+1,b+n+1);
for(int i=1;i<=n+1;i++)
{
ll val=0;
vector<int> vals;
for(int j=1;j<=n+1;j++)
if(j!=i)
vals.push_back(a[j]);
sort(vals.begin(),vals.end());
for(int j=0;j<vals.size();j++)
{
ll x=max(0LL,vals[j]-b[j+1]);
val=max(val,x);
}
cout<<val<<' ';
}
return 0;
}
Compilation message
ho_t1.cpp: In function 'int main()':
ho_t1.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(int j=0;j<vals.size();j++)
| ~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
26 ms |
340 KB |
Output is correct |
15 |
Correct |
78 ms |
396 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
140 ms |
408 KB |
Output is correct |
18 |
Correct |
101 ms |
396 KB |
Output is correct |
19 |
Correct |
107 ms |
400 KB |
Output is correct |
20 |
Correct |
104 ms |
408 KB |
Output is correct |
21 |
Correct |
103 ms |
408 KB |
Output is correct |
22 |
Correct |
97 ms |
404 KB |
Output is correct |
23 |
Correct |
102 ms |
396 KB |
Output is correct |
24 |
Correct |
110 ms |
388 KB |
Output is correct |
25 |
Correct |
155 ms |
412 KB |
Output is correct |
26 |
Correct |
141 ms |
392 KB |
Output is correct |
27 |
Correct |
141 ms |
392 KB |
Output is correct |
28 |
Correct |
146 ms |
388 KB |
Output is correct |
29 |
Correct |
115 ms |
388 KB |
Output is correct |
30 |
Correct |
131 ms |
392 KB |
Output is correct |
31 |
Correct |
163 ms |
340 KB |
Output is correct |
32 |
Correct |
167 ms |
400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
26 ms |
340 KB |
Output is correct |
15 |
Correct |
78 ms |
396 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
140 ms |
408 KB |
Output is correct |
18 |
Correct |
101 ms |
396 KB |
Output is correct |
19 |
Correct |
107 ms |
400 KB |
Output is correct |
20 |
Correct |
104 ms |
408 KB |
Output is correct |
21 |
Correct |
103 ms |
408 KB |
Output is correct |
22 |
Correct |
97 ms |
404 KB |
Output is correct |
23 |
Correct |
102 ms |
396 KB |
Output is correct |
24 |
Correct |
110 ms |
388 KB |
Output is correct |
25 |
Correct |
155 ms |
412 KB |
Output is correct |
26 |
Correct |
141 ms |
392 KB |
Output is correct |
27 |
Correct |
141 ms |
392 KB |
Output is correct |
28 |
Correct |
146 ms |
388 KB |
Output is correct |
29 |
Correct |
115 ms |
388 KB |
Output is correct |
30 |
Correct |
131 ms |
392 KB |
Output is correct |
31 |
Correct |
163 ms |
340 KB |
Output is correct |
32 |
Correct |
167 ms |
400 KB |
Output is correct |
33 |
Execution timed out |
1081 ms |
8868 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |