Submission #596991

#TimeUsernameProblemLanguageResultExecution timeMemory
596991f1nderTuna (COCI17_tuna)C++17
50 / 50
1 ms212 KiB
#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 timeMemoryGrader output
Fetching results...