Submission #398922

#TimeUsernameProblemLanguageResultExecution timeMemory
398922AlexandraTuna (COCI17_tuna)C++14
50 / 50
1 ms316 KiB
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, resp=0, x; cin >> n; cin >> x; for (int i=0; i<n; i++) { int p1, p2; cin >> p1 >> p2; if (p1<p2) { if (p2-p1<=x) { resp += p2; } else { int p3; cin >> p3; resp += p3; } } else { if (p1-p2<=x) { resp += p1; } else { int p3; cin >> p3; resp += p3; } } } cout << resp; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...