답안 #873613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873613 2023-11-15T11:29:34 Z vjudge1 Tuna (COCI17_tuna) C++17
50 / 50
1 ms 408 KB
#include<bits/stdc++.h>
#ifdef LOCAL
#include "Essentials/algo/debug.h"
#else
#define debug(...) 69
#endif
using namespace std;

typedef long long     ll;
typedef pair<int,int> pii;

const int N = 5e5 + 23;
const ll inf = 1e18;

#define F           first
#define S           second
#define pb          push_back
#define kill(x)     cout<<x<<endl, exit(0);
#define all(x)      x.begin(),x.end()
#define sz(x)       (int)x.size()
#define lc          (v << 1)
#define rc          ((v<<1) |1)

int n,x;

int32_t main() {
    cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n>>x;
	ll ans= 0;
	for(int i = 0 ; i < n ; i++) {
		int a,b; cin>>a>>b;
		if(a > b) swap(a,b);
		if(b-a <=x) {
			ans += b;
		} else {
			int sex; cin>>sex;
			ans += sex;
		}
	}
	cout<<ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 408 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct