Submission #597906

# Submission time Handle Problem Language Result Execution time Memory
597906 2022-07-17T05:54:51 Z Devigo Tuna (COCI17_tuna) C++14
50 / 50
1 ms 324 KB
#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 time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct