제출 #597097

#제출 시각아이디문제언어결과실행 시간메모리
597097kabikaTuna (COCI17_tuna)C++14
50 / 50
1 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n >> x;
    int tot = 0;
    while(n--)
    {
        int p1, p2;
        cin >> p1 >> p2;
        if(abs(p2-p1) <= x)
            tot += max(p1,p2);
        else
        {
            int p3;
            cin >> p3;
            tot += p3;
        }
    }
    cout << tot << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...