#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n=0;
int x=0;
int a=0;
int b=0;
int c=0;
int i=0;
cin>>n;
cin>>x;
for(i=0;i<n;i++) {
cin>>a>>b;
if(abs(a - b) > x) {
cin>>a;
c += a;
}
else
c += max(a, b);
}
cout<<c<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |