# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398922 | Alexandra | Tuna (COCI17_tuna) | C++14 | 1 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |