Submission #1110647

#TimeUsernameProblemLanguageResultExecution timeMemory
1110647vjudge1Tuna (COCI17_tuna)C++17
50 / 50
1 ms400 KiB
#include <bits/stdc++.h> // include all standard headers
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, x;
    cin >> n >> x;

    int n1, n2, n3;
    int total = 0;

    while(n--){
        cin >> n1 >> n2;
        if(abs(n1 - n2) > x){
            cin >> n3;
            total += n3;
        }
        else total += max(n1, n2);
    }

    cout << total << endl;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...