/*梁*/
#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];
}
vector<int> order(n);iota(order.begin(),order.end(),0);
sort(order.begin(),order.end(),[&](int i,int j){
return x[i]+p[i]<x[j]+p[j];
});
int mx=x[order[0]]+p[order[0]];
int ans=0;
for(int i=1;i<n;i++){
ans+=max(0,x[order[i]]-p[order[i]]-mx);
}
cout<<ans<<'\n';
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |