Submission #596991

# Submission time Handle Problem Language Result Execution time Memory
596991 2022-07-15T11:12:59 Z f1nder Tuna (COCI17_tuna) C++17
50 / 50
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
 

   
int t=1;
while(t--)
{
	solve();
	cout<<"\n";
}

return 0;
}
void solve()
{
    int n,k;cin>>n>>k;
    int ans=0;
    for (int i = 0; i < n; i++) {
        /* code */
        int h,j;cin>>h>>j;
        if(abs(h-j)<=k) ans+=max(h,j);
        else{
            int l;cin>>l;
            ans+=l;
        }
    }
    cout<<ans;
}	

# 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct