Submission #1174018

#TimeUsernameProblemLanguageResultExecution timeMemory
1174018NomioTuna (COCI17_tuna)C++20
50 / 50
0 ms328 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	int x;
	cin >> x;
	ll s = 0;
	for(int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if(abs(a - b) > x) {
			int c;
			cin >> c;
			s += c;
		} else s += max(a, b);
	}
	cout << s << '\n';
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...