Submission #136802

# Submission time Handle Problem Language Result Execution time Memory
136802 2019-07-26T09:37:47 Z RiscadoA Tuna (COCI17_tuna) C++14
50 / 50
2 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 20;
const int MAX_X = 10;

int N, X, S;

int main()
{
	S = 0;

	cin >> N >> X;
	for (int i = 0, a, b, c; i < N; ++i) {
		cin >> a >> b;
		if (b > a) {
                        if (b - a <= X)
				 c = b;
			else
				cin >> c;
		} else {
			if (a - b <= X)
				 c = a;
			else
				cin >> c;
		}
		S += c;
	}

	cout << S;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct