답안 #597495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597495 2022-07-16T07:16:12 Z chinmoy_101 Tuna (COCI17_tuna) C++14
50 / 50
1 ms 300 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n, x, ans=0;
    cin>>n;
    cin>>x;
    for(int i=1; i<=n; i++)
    {
        int p1, p2, p3;
        cin>>p1 >>p2;
        if(abs(p1-p2)<=x)
        {
            ans+=max(p1, p2);
        }
        else
        {
            cin>>p3;
            ans+=p3;
        }
    }
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 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 296 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct