# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596918 | zeroesandones | Tuna (COCI17_tuna) | C++17 | 1 ms | 336 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb push_back
void solve()
{
ll n, x;
cin >> n >> x;
ll ans = 0;
FOR(i, 0, n) {
ll p1, p2;
cin >> p1 >> p2;
if(abs(p1 - p2) <= x)
ans += max(p1, p2);
else {
int p3;
cin >> p3;
ans += p3;
}
}
cout << ans << nl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |