Submission #597906

#TimeUsernameProblemLanguageResultExecution timeMemory
597906DevigoTuna (COCI17_tuna)C++14
50 / 50
1 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair const int siz = 0; const int mod = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int x; cin >> x; long long val = 0; while(n--) { int a, b; cin >> a >> b; int dif = abs(a-b); if(dif <= x) { val += max(a,b); } else { int c; cin >> c; val += c; } } cout << val << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...