Submission #597495

# Submission time Handle Problem Language Result Execution time Memory
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;
}
# Verdict Execution time Memory 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