답안 #646097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646097 2022-09-28T15:56:47 Z Ghosty_v2 Tuna (COCI17_tuna) C++14
50 / 50
1 ms 324 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long 

int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(0);

	ll n,x;
	cin>>n>>x;
	ll sum = 0;
	for(int i=0;i<n;i++) {
		ll a,b,c;
		cin>>a>>b;
		if (abs(a-b) > x) {
			cin>>c;
			sum+=c;
		}
		else{
			if (a >= b) {
				sum+=a;
			}
			else {
				sum+=b;
			}
		}

	}

	cout<<sum<<endl;

	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 324 KB Output is correct
9 Correct 0 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct