/*梁*/
#include <bits/stdc++.h>
using namespace std;
void solve(){
int n,k; cin>>n>>k;
vector<int> x(n),p(n),s(n);
for(int i=0;i<n;i++){
cin>>x[i]>>p[i]>>s[i];
}
sort(p.begin(),p.end(),[&](int i,int j){
return x[i]<x[j];
});
sort(s.begin(),s.end(),[&](int i,int j){
return x[i]<x[j];
});
sort(x.begin(),x.end(),[&](int i,int j){
return x[i]<x[j];
});
int ans=0;
for(int i=0;i<n;i++){
int mx=0;
for(int j=i+1;j<n;j++){
mx=max(mx,max(0,abs(x[i]-x[j])-p[i]-p[j]));
}
ans+=mx;
}
cout<<ans<<'\n';
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |