Submission #1103684

# Submission time Handle Problem Language Result Execution time Memory
1103684 2024-10-21T14:24:03 Z melody_rules Tuna (COCI17_tuna) C++17
50 / 50
1 ms 504 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main() {
  int n=0;
  int x=0;
  int a=0;
  int b=0;
  int c=0;
  int i=0;
  
  cin>>n;
  cin>>x;
  
  for(i=0;i<n;i++) {
    cin>>a>>b;
    
    if(abs(a - b) > x) {
      cin>>a;
      c += a;
    }
    
    else
      c += max(a, b);
  }
  
  cout<<c<<endl;
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct