Submission #170326

#TimeUsernameProblemLanguageResultExecution timeMemory
170326ngmhTuna (COCI17_tuna)C++11
50 / 50
2 ms396 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n, x, a, b, c, t = 0;
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        if(abs(a-b) <= x) t += max(a, b);
        else {
            cin >> c;
            t += c;
        }
    }
    cout << t;
}
#Verdict Execution timeMemoryGrader output
Fetching results...