Submission #1110638

# Submission time Handle Problem Language Result Execution time Memory
1110638 2024-11-10T06:39:45 Z vjudge1 Tuna (COCI17_tuna) C++17
50 / 50
1 ms 512 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repi(i,a,b) for(int i=a-1;i>=b;i--)
#define fi first
#define se second
#define MOD 100000007
#define ll long long
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
//#define int long long

using namespace std;

int n,x;

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