# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136914 | dnass | Tuna (COCI17_tuna) | C++14 | 7 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int myabs(int k){
if(k<0) return -k;
return k;
}
int n, x;
int main(){
scanf("%d %d", &n, &x);
int sum = 0;
while(n--){
int p1, p2; scanf("%d %d", &p1, &p2);
if(myabs(p1-p2)<=x) sum += max(p1, p2);
else{
int p3; scanf("%d", &p3);
sum += p3;
}
}
printf("%d\n", sum);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |